"Fossies" - the Fresh Open Source Software Archive

Member "mod_log_sql-1.101/mod_log_sql_ssl.c" (14 May 2004, 2506 Bytes) of package /linux/www/apache_httpd_modules/old/mod_log_sql-1.101.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* $Id: mod_log_sql_ssl.c 140 2004-05-14 03:50:47Z urkle@drip.ws $ */
    2 
    3 #if defined(WITH_APACHE20)
    4 #   include "apache20.h"
    5 #elif defined(WITH_APACHE13)
    6 #   include "apache13.h"
    7 #else
    8 #   error Unsupported Apache version
    9 #endif
   10 
   11 #ifdef HAVE_CONFIG_H
   12 /* Undefine these to prevent conflicts between Apache ap_config_auto.h and 
   13  * my config.h. Only really needed for Apache < 2.0.48, but it can't hurt.
   14  */
   15 #undef PACKAGE_BUGREPORT
   16 #undef PACKAGE_NAME
   17 #undef PACKAGE_STRING
   18 #undef PACKAGE_TARNAME
   19 #undef PACKAGE_VERSION
   20 
   21 #include "config.h"
   22 #endif
   23 
   24 #include "mod_log_sql.h"
   25 
   26 #include "mod_ssl.h"
   27 
   28 #if defined(WITH_APACHE20)
   29 static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *header_ssl_lookup = NULL;
   30 #   define TEST_SSL(r) header_ssl_lookup
   31 #elif defined(WITH_APACHE13)
   32 #   define TEST_SSL(r) ap_ctx_get(r->connection->client->ctx, "ssl")
   33 #   define header_ssl_lookup ssl_var_lookup
   34 #endif
   35 
   36 static const char *extract_ssl_keysize(request_rec *r, char *a)
   37 {
   38     char *result = NULL;
   39     if (TEST_SSL(r) != NULL)
   40     {
   41         result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_USEKEYSIZE");
   42         log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_KEYSIZE: %s", result);
   43         if (result && result[0])
   44             return result;
   45         else
   46             return "0";
   47     } else {
   48         return "0";
   49     }
   50 }
   51 
   52 static const char *extract_ssl_maxkeysize(request_rec *r, char *a)
   53 {
   54     char *result = NULL;
   55     if (TEST_SSL(r) != NULL) 
   56     {
   57         result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER_ALGKEYSIZE");
   58         log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_ALGKEYSIZE: %s", result);
   59         if (result && result[0])
   60             return result;
   61         else
   62             return "0";
   63     } else {
   64         return "0";
   65     }
   66 }
   67 
   68 static const char *extract_ssl_cipher(request_rec *r, char *a)
   69 {
   70     char *result = NULL;
   71     if (TEST_SSL(r) != NULL)
   72     {
   73         result = header_ssl_lookup(r->pool, r->server, r->connection, r, "SSL_CIPHER");
   74         log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"SSL_CIPHER: %s", result);
   75         if (result && result[0])
   76             return result;
   77         else
   78             return "0";
   79     } else {
   80         return "-";
   81     }
   82 }
   83 
   84 
   85 LOGSQL_REGISTER(ssl)
   86 {
   87     log_sql_register_item(s,p,'q', extract_ssl_keysize,       "ssl_keysize",      0, 1);
   88     log_sql_register_item(s,p,'Q', extract_ssl_maxkeysize,    "ssl_maxkeysize",   0, 1);
   89     log_sql_register_item(s,p,'z', extract_ssl_cipher,        "ssl_cipher",       0, 1);
   90 #if defined(WITH_APACHE20)
   91     header_ssl_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup);
   92 #endif
   93     LOGSQL_REGISTER_RETURN;
   94 }