diff options
author | Paul Querna | 2005-04-24 23:41:15 +0000 |
---|---|---|
committer | Paul Querna | 2005-04-24 23:41:15 +0000 |
commit | 7ba803bf96524267acc84998904405ca1936b47a (patch) | |
tree | 5866c64c9ef0028c8030a75dc01a0f383c9b14e2 | |
parent | c301152dbbdf13c4bf212c7982b948c21149468d (diff) |
add SSL_SERVER_S_DN and SSL_SERVER_I_DN
-rw-r--r-- | src/gnutls_hooks.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/gnutls_hooks.c b/src/gnutls_hooks.c index 5429d66..f36f9de 100644 --- a/src/gnutls_hooks.c +++ b/src/gnutls_hooks.c | |||
@@ -520,10 +520,12 @@ int mgs_hook_pre_connection(conn_rec * c, void *csd) | |||
520 | int mgs_hook_fixups(request_rec *r) | 520 | int mgs_hook_fixups(request_rec *r) |
521 | { | 521 | { |
522 | unsigned char sbuf[GNUTLS_MAX_SESSION_ID]; | 522 | unsigned char sbuf[GNUTLS_MAX_SESSION_ID]; |
523 | char buf[GNUTLS_SESSION_ID_STRING_LEN]; | 523 | char buf[AP_IOBUFSIZE]; |
524 | const char* tmp; | 524 | const char* tmp; |
525 | int len; | 525 | int len; |
526 | mgs_handle_t *ctxt; | 526 | mgs_handle_t *ctxt; |
527 | int rv; | ||
528 | |||
527 | apr_table_t *env = r->subprocess_env; | 529 | apr_table_t *env = r->subprocess_env; |
528 | 530 | ||
529 | ctxt = ap_get_module_config(r->connection->conn_config, &gnutls_module); | 531 | ctxt = ap_get_module_config(r->connection->conn_config, &gnutls_module); |
@@ -556,7 +558,41 @@ int mgs_hook_fixups(request_rec *r) | |||
556 | gnutls_session_get_id(ctxt->session, sbuf, &len); | 558 | gnutls_session_get_id(ctxt->session, sbuf, &len); |
557 | tmp = mgs_session_id2sz(sbuf, len, buf, sizeof(buf)); | 559 | tmp = mgs_session_id2sz(sbuf, len, buf, sizeof(buf)); |
558 | apr_table_setn(env, "SSL_SESSION_ID", tmp); | 560 | apr_table_setn(env, "SSL_SESSION_ID", tmp); |
561 | |||
562 | /* TODO: There are many other env vars that we need to add */ | ||
563 | { | ||
564 | const gnutls_datum *certs; | ||
565 | gnutls_x509_crt cert; | ||
566 | |||
567 | certs = gnutls_certificate_get_ours(ctxt->session); | ||
568 | if (certs) { | ||
569 | |||
570 | rv = gnutls_x509_crt_init(&cert); | ||
571 | if (rv < 0) { | ||
572 | goto end_fixups; | ||
573 | } | ||
574 | |||
575 | rv = gnutls_x509_crt_import(cert, &certs[0], GNUTLS_X509_FMT_DER); | ||
576 | if (rv < 0) { | ||
577 | gnutls_x509_crt_deinit(cert); | ||
578 | goto end_fixups; | ||
579 | } | ||
580 | |||
581 | len = sizeof(buf); | ||
582 | if (gnutls_x509_crt_get_dn(cert, buf, &len) == 0) { | ||
583 | apr_table_setn(env, "SSL_SERVER_S_DN", buf); | ||
584 | } | ||
585 | |||
586 | len = sizeof(buf); | ||
587 | if (gnutls_x509_crt_get_issuer_dn(cert, buf, &len) == 0) { | ||
588 | apr_table_setn(env, "SSL_SERVER_I_DN", buf); | ||
589 | } | ||
590 | |||
591 | gnutls_x509_crt_deinit(cert); | ||
592 | } | ||
593 | } | ||
559 | 594 | ||
595 | end_fixups: | ||
560 | return OK; | 596 | return OK; |
561 | } | 597 | } |
562 | 598 | ||