Changeset 7ba803b in mod_gnutls


Ignore:
Timestamp:
Apr 24, 2005, 7:41:15 PM (18 years ago)
Author:
Paul Querna <chip@…>
Branches:
asyncio, debian/master, debian/stretch-backports, jessie-backports, main, master, msva, proxy-ticket, upstream
Children:
46e3920
Parents:
c301152
Message:

add SSL_SERVER_S_DN and SSL_SERVER_I_DN

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_hooks.c

    rc301152 r7ba803b  
    521521{
    522522    unsigned char sbuf[GNUTLS_MAX_SESSION_ID];
    523     char buf[GNUTLS_SESSION_ID_STRING_LEN];
     523    char buf[AP_IOBUFSIZE];
    524524    const char* tmp;
    525525    int len;
    526526    mgs_handle_t *ctxt;
     527    int rv;
     528   
    527529    apr_table_t *env = r->subprocess_env;
    528530
     
    557559    tmp = mgs_session_id2sz(sbuf, len, buf, sizeof(buf));
    558560    apr_table_setn(env, "SSL_SESSION_ID", tmp);
    559    
     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    }
     594   
     595end_fixups:
    560596    return OK;
    561597}
Note: See TracChangeset for help on using the changeset viewer.