Changeset b4739cd in mod_gnutls for src/gnutls_hooks.c


Ignore:
Timestamp:
Dec 3, 2013, 4:28:42 PM (6 years ago)
Author:
Daniel Kahn Gillmor <dkg@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, upstream
Children:
9717fe4
Parents:
37b52ea
Message:

display some information in mod_status

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_hooks.c

    r37b52ea rb4739cd  
    2121#include "http_vhost.h"
    2222#include "ap_mpm.h"
     23#include "mod_status.h"
    2324
    2425#ifdef ENABLE_MSVA
     
    4142static void mgs_add_common_pgpcert_vars(request_rec * r, gnutls_openpgp_crt_t cert, int side, int export_full_cert);
    4243static const char* mgs_x509_construct_uid(request_rec * pool, gnutls_x509_crt_t cert);
     44static int mgs_status_hook(request_rec *r, int flags);
    4345
    4446/* Pool Cleanup Function */
     
    109111                return DONE;
    110112    }
     113
     114    AP_OPTIONAL_HOOK(status_hook, mgs_status_hook, NULL, NULL, APR_HOOK_MIDDLE);
    111115
    112116        /* Register a pool clean-up function */
     
    15081512    return ret;
    15091513}
     1514
     1515static int mgs_status_hook(request_rec *r, int flags)
     1516{
     1517    mgs_srvconf_rec *sc;
     1518
     1519    if (r == NULL)
     1520        return OK;
     1521
     1522    sc = (mgs_srvconf_rec *) ap_get_module_config(r->server->module_config, &gnutls_module);
     1523
     1524    _gnutls_log(debug_log_fp, "%s: %d\n", __func__, __LINE__);
     1525
     1526    ap_rputs("<hr>\n", r);
     1527    ap_rputs("<h2>GnuTLS Information:</h2>\n<dl>\n", r);
     1528
     1529    ap_rprintf(r, "<dt>GnuTLS version:</dt><dd>%s</dd>\n", gnutls_check_version(NULL));
     1530    ap_rputs("<dt>Built against:</dt><dd>" GNUTLS_VERSION "</dd>\n", r);
     1531    ap_rprintf(r, "<dt>using TLS:</dt><dd>%s</dd>\n", (sc->enabled == GNUTLS_ENABLED_FALSE ? "no" : "yes"));
     1532    if (sc->enabled != GNUTLS_ENABLED_FALSE) {
     1533        mgs_handle_t* ctxt;
     1534        char* z = NULL;
     1535        ctxt = ap_get_module_config(r->connection->conn_config, &gnutls_module);
     1536        if (ctxt && ctxt->session != NULL) {
     1537            z = gnutls_session_get_desc(ctxt->session);
     1538            if (z) {
     1539                ap_rprintf(r, "<dt>This TLS Session:</dt><dd>%s</dd>\n", z);
     1540                gnutls_free(z);
     1541            }
     1542        }
     1543    }
     1544
     1545    ap_rputs("</dl>\n", r);
     1546    return OK;
     1547}
     1548
Note: See TracChangeset for help on using the changeset viewer.