You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/12/07 23:33:36 UTC

svn commit: r1211680 - in /httpd/httpd/trunk: docs/log-message-tags/ modules/cluster/ modules/examples/ modules/proxy/balancers/ modules/ssl/

Author: sf
Date: Wed Dec  7 22:33:35 2011
New Revision: 1211680

URL: http://svn.apache.org/viewvc?rev=1211680&view=rev
Log:
Various fixes for log message tags:

- Remove tags in ssl_log_ssl_error() and ssl_log_cert_error()
- Instead add tags to various ssl_log_xerror, ssl_log_cxerror
  calls (ssl_log_rxerror is unused).
- likewise for modssl_proxy_info_log()

- Fix spelling of APLOG_NOERRNO in coccinelle script
- add support for ssl_log_*error and ap_log_cserror

- add some more tags missing due to APLOG_NOERRNO spelling error

- Remove tags from example modules (we don't want people to blindly copy
  those)


Modified:
    httpd/httpd/trunk/docs/log-message-tags/find-messages.cocci
    httpd/httpd/trunk/docs/log-message-tags/next-number
    httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
    httpd/httpd/trunk/modules/examples/mod_example_hooks.c
    httpd/httpd/trunk/modules/examples/mod_example_ipc.c
    httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c
    httpd/httpd/trunk/modules/ssl/ssl_engine_init.c
    httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
    httpd/httpd/trunk/modules/ssl/ssl_engine_log.c
    httpd/httpd/trunk/modules/ssl/ssl_engine_ocsp.c
    httpd/httpd/trunk/modules/ssl/ssl_util.c

Modified: httpd/httpd/trunk/docs/log-message-tags/find-messages.cocci
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/log-message-tags/find-messages.cocci?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/log-message-tags/find-messages.cocci (original)
+++ httpd/httpd/trunk/docs/log-message-tags/find-messages.cocci Wed Dec  7 22:33:35 2011
@@ -1,4 +1,4 @@
-@r@
+@r1@
 expression rv, s;
 constant char [] format;
 identifier level =~ "^APLOG_(EMERG|ALERT|CRIT|ERR|WARNING|NOTICE|INFO|STARTUP|DEBUG)$";
@@ -9,10 +9,67 @@ identifier fn =~ "^ap_log_(|r|c|p)error$
 (
         level
 |
-        level|APLOG_NOERROR
+        level|APLOG_NOERRNO
 |
         level|APLOG_STARTUP
 )
         ,rv, s
 +       , APLOGNO()
         ,format, ...)
+
+@r2@
+expression rv, s, c;
+constant char [] format;
+identifier level =~ "^APLOG_(EMERG|ALERT|CRIT|ERR|WARNING|NOTICE|INFO|STARTUP|DEBUG)$";
+
+@@
+        ap_log_cserror( APLOG_MARK ,
+(
+        level
+|
+        level|APLOG_NOERRNO
+|
+        level|APLOG_STARTUP
+)
+        ,rv, s, c
++       , APLOGNO()
+        ,format, ...)
+
+@r3@
+expression rv, p, s, cert;
+constant char [] format;
+identifier level =~ "^APLOG_(EMERG|ALERT|CRIT|ERR|WARNING|NOTICE|INFO|STARTUP|DEBUG)$";
+
+@@
+        ssl_log_xerror( SSLLOG_MARK ,
+(
+        level
+|
+        level|APLOG_NOERRNO
+|
+        level|APLOG_STARTUP
+)
+        ,rv, p, s , cert
++       , APLOGNO()
+        ,format, ...)
+
+@r4@
+expression rv, rc, cert;
+constant char [] format;
+identifier level =~ "^APLOG_(EMERG|ALERT|CRIT|ERR|WARNING|NOTICE|INFO|STARTUP|DEBUG)$";
+identifier fn =~ "^ssl_log_(r|c)xerror$";
+
+@@
+        fn( SSLLOG_MARK ,
+(
+        level
+|
+        level|APLOG_NOERRNO
+|
+        level|APLOG_STARTUP
+)
+        ,rv, rc , cert
++       , APLOGNO()
+        ,format, ...)
+
+

Modified: httpd/httpd/trunk/docs/log-message-tags/next-number
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/log-message-tags/next-number?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/log-message-tags/next-number (original)
+++ httpd/httpd/trunk/docs/log-message-tags/next-number Wed Dec  7 22:33:35 2011
@@ -1 +1 @@
-2270
+2286

Modified: httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c (original)
+++ httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c Wed Dec  7 22:33:35 2011
@@ -684,7 +684,7 @@ static int hm_post_config(apr_pool_t *p,
             storage = ap_lookup_provider(AP_SLOTMEM_PROVIDER_GROUP, "shm",
                                          AP_SLOTMEM_PROVIDER_VERSION);
             if (!storage) {
-                ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s,
+                ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(02284)
                              "failed to lookup provider 'shm' for '%s', "
                              "maybe you need to load mod_slotmem_shm?",
                              AP_SLOTMEM_PROVIDER_GROUP);
@@ -692,7 +692,8 @@ static int hm_post_config(apr_pool_t *p,
             }
             storage->create(&slotmem, "mod_heartmonitor", sizeof(hm_slot_server_t), maxworkers, AP_SLOTMEM_TYPE_PREGRAB, p);
             if (!slotmem) {
-                ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "slotmem_create for status failed");
+                ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(02285)
+                             "slotmem_create for status failed");
                 return !OK;
             }
         }

Modified: httpd/httpd/trunk/modules/examples/mod_example_hooks.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/examples/mod_example_hooks.c?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/examples/mod_example_hooks.c (original)
+++ httpd/httpd/trunk/modules/examples/mod_example_hooks.c Wed Dec  7 22:33:35 2011
@@ -328,8 +328,7 @@ static x_cfg *our_cconfig(const conn_rec
 static void example_log_each(apr_pool_t *p, server_rec *s, const char *note)
 {
     if (s != NULL) {
-        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02062) "mod_example: %s",
-                     note);
+        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "mod_example: %s", note);
     } else {
         apr_file_t *out = NULL;
         apr_file_open_stderr(&out, p);

Modified: httpd/httpd/trunk/modules/examples/mod_example_ipc.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/examples/mod_example_ipc.c?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/examples/mod_example_ipc.c (original)
+++ httpd/httpd/trunk/modules/examples/mod_example_ipc.c Wed Dec  7 22:33:35 2011
@@ -141,7 +141,7 @@ static int exipc_post_config(apr_pool_t 
      */
     rs = apr_temp_dir_get(&tempdir, pconf);
     if (APR_SUCCESS != rs) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, rs, s, APLOGNO(02063)
+        ap_log_error(APLOG_MARK, APLOG_ERR, rs, s,
                      "Failed to find temporary directory");
         return HTTP_INTERNAL_SERVER_ERROR;
     }
@@ -159,7 +159,7 @@ static int exipc_post_config(apr_pool_t 
     rs = apr_shm_create(&exipc_shm, sizeof(exipc_data),
                         (const char *) shmfilename, pconf);
     if (APR_SUCCESS != rs) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, rs, s, APLOGNO(02064)
+        ap_log_error(APLOG_MARK, APLOG_ERR, rs, s,
                      "Failed to create shared memory segment on file %s",
                      shmfilename);
         return HTTP_INTERNAL_SERVER_ERROR;
@@ -204,7 +204,7 @@ static void exipc_child_init(apr_pool_t 
                                      apr_global_mutex_lockfile(exipc_mutex),
                                      p);
     if (APR_SUCCESS != rs) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rs, s, APLOGNO(02065)
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rs, s,
                      "Failed to reopen mutex %s in child",
                      exipc_mutex_type);
         /* There's really nothing else we can do here, since This
@@ -261,14 +261,14 @@ static int exipc_handler(request_rec *r)
                 break; /* Out of the loop */
             } else {
                 /* Some error, log and bail */
-                ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server, APLOGNO(02066)
+                ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server,
                              "Child %ld failed to acquire lock",
                              (long int)getpid());
                 break; /* Out of the loop without having the lock */
             }
         } else {
             /* Some other error, log and bail */
-            ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server, APLOGNO(02067)
+            ap_log_error(APLOG_MARK, APLOG_ERR, rs, r->server,
                          "Child %ld failed to try and acquire lock",
                          (long int)getpid());
             break; /* Out of the loop without having the lock */

Modified: httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c (original)
+++ httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c Wed Dec  7 22:33:35 2011
@@ -374,7 +374,7 @@ static int lb_hb_init(apr_pool_t *p, apr
     storage = ap_lookup_provider(AP_SLOTMEM_PROVIDER_GROUP, "shm",
                                  AP_SLOTMEM_PROVIDER_VERSION);
     if (!storage) {
-        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, APLOGNO(02281)
                      "Failed to lookup provider 'shm' for '%s'. Maybe you "
                      "need to load mod_slotmem_shm?",
                      AP_SLOTMEM_PROVIDER_GROUP);
@@ -384,10 +384,10 @@ static int lb_hb_init(apr_pool_t *p, apr
     /* Try to use a slotmem created by mod_heartmonitor */
     storage->attach(&hm_serversmem, "mod_heartmonitor", &size, &num, p);
     if (!hm_serversmem)
-        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, APLOGNO(02282)
                      "No slotmem from mod_heartmonitor");
     else
-        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, APLOGNO(02283)
                      "Using slotmem from mod_heartmonitor");
 
     if (hm_serversmem)

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_init.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_init.c?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_init.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_init.c Wed Dec  7 22:33:35 2011
@@ -1257,8 +1257,9 @@ static void ssl_init_proxy_certs(server_
         if (X509_verify_cert(sctx) != 1) {
             int err = X509_STORE_CTX_get_error(sctx);
             ssl_log_xerror(SSLLOG_MARK, APLOG_WARNING, 0, ptemp, s, inf->x509,
-                         "SSL proxy client cert chain verification failed: %s :",
-                          X509_verify_cert_error_string(err));
+                           APLOGNO(02270) "SSL proxy client cert chain "
+                           "verification failed: %s :",
+                           X509_verify_cert_error_string(err));
         }
 
         /* Clear X509_verify_cert errors */
@@ -1282,8 +1283,9 @@ static void ssl_init_proxy_certs(server_
             }
 
             ssl_log_xerror(SSLLOG_MARK, APLOG_DEBUG, 0, ptemp, s, inf->x509,
-                         "loaded %i intermediate CA%s for cert %i: ",
-                         i, i == 1 ? "" : "s", n);
+                           APLOGNO(02271)
+                           "loaded %i intermediate CA%s for cert %i: ",
+                           i, i == 1 ? "" : "s", n);
             if (i > 0) {
                 int j;
                 for (j = 0; j < i; j++) {

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c Wed Dec  7 22:33:35 2011
@@ -1429,7 +1429,7 @@ int ssl_callback_SSLVerify(int ok, X509_
      * Log verification information
      */
     ssl_log_cxerror(SSLLOG_MARK, APLOG_DEBUG, 0, conn,
-                    X509_STORE_CTX_get_current_cert(ctx),
+                    X509_STORE_CTX_get_current_cert(ctx), APLOGNO(02275)
                     "Certificate Verification, depth %d, "
                     "CRL checking mode: %s", errdepth,
                     mctx->crl_check_mode == SSL_CRLCHECK_CHAIN ?
@@ -1514,7 +1514,7 @@ int ssl_callback_SSLVerify(int ok, X509_
     if (!ok) {
         if (APLOGcinfo(conn)) {
             ssl_log_cxerror(SSLLOG_MARK, APLOG_INFO, 0, conn,
-                            X509_STORE_CTX_get_current_cert(ctx),
+                            X509_STORE_CTX_get_current_cert(ctx), APLOGNO(02276)
                             "Certificate Verification: Error (%d): %s",
                             errnum, X509_verify_cert_error_string(errnum));
         } else {
@@ -1567,7 +1567,7 @@ static void modssl_proxy_info_log(conn_r
                                   X509_INFO *info,
                                   const char *msg)
 {
-    ssl_log_cxerror(SSLLOG_MARK, APLOG_DEBUG, 0, c, info->x509,
+    ssl_log_cxerror(SSLLOG_MARK, APLOG_DEBUG, 0, c, info->x509, APLOGNO(02277)
                     SSLPROXY_CERT_CB_LOG_FMT "%s, sending",
                     (mySrvConfigFromConn(c))->vhost_id, msg);
 }
@@ -1618,7 +1618,7 @@ int ssl_callback_proxy_cert(SSL *ssl, X5
          */
         info = sk_X509_INFO_value(certs, 0);
 
-        modssl_proxy_info_log(c, info, "no acceptable CA list");
+        modssl_proxy_info_log(c, info, APLOGNO(02278) "no acceptable CA list");
 
         modssl_set_cert_info(info, x509, pkey);
 
@@ -1635,7 +1635,8 @@ int ssl_callback_proxy_cert(SSL *ssl, X5
 
             /* Search certs (by issuer name) one by one*/
             if (X509_NAME_cmp(issuer, ca_name) == 0) {
-                modssl_proxy_info_log(c, info, "found acceptable cert");
+                modssl_proxy_info_log(c, info, APLOGNO(02279)
+                                      "found acceptable cert");
 
                 modssl_set_cert_info(info, x509, pkey);
 
@@ -1653,7 +1654,8 @@ int ssl_callback_proxy_cert(SSL *ssl, X5
                     ca_issuer = X509_get_issuer_name(ca_cert);
 
                     if(X509_NAME_cmp(ca_issuer, ca_name) == 0 ) {
-                        modssl_proxy_info_log(c, info, "found acceptable cert by intermediate CA");
+                        modssl_proxy_info_log(c, info, APLOGNO(02280)
+                                              "found acceptable cert by intermediate CA");
 
                         modssl_set_cert_info(info, x509, pkey);
 

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_log.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_log.c?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_log.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_log.c Wed Dec  7 22:33:35 2011
@@ -94,7 +94,7 @@ void ssl_log_ssl_error(const char *file,
         annotation = ssl_log_annotation(err);
 
         ap_log_error(file, line, APLOG_MODULE_INDEX, level, 0, s,
-                     APLOGNO(02021) "SSL Library Error: %s%s%s%s%s%s",
+                     "SSL Library Error: %s%s%s%s%s%s",
                      /* %s */
                      err,
                      /* %s%s%s */
@@ -135,7 +135,7 @@ static void ssl_log_cert_error(const cha
              */
             int maxdnlen = (HUGE_STRING_LEN - msglen - 300) / 2;
 
-            BIO_puts(bio, APLOGNO(02022) " [subject: ");
+            BIO_puts(bio, " [subject: ");
             name = SSL_X509_NAME_to_string(p, X509_get_subject_name(cert),
                                            maxdnlen);
             if (!strIsEmpty(name)) {
@@ -174,7 +174,7 @@ static void ssl_log_cert_error(const cha
     }
     else {
         apr_snprintf(buf + msglen, sizeof buf - msglen,
-                     APLOGNO(02023) " [certificate: -not available-]");
+                     " [certificate: -not available-]");
     }
 
     if (r) {

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_ocsp.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_ocsp.c?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_ocsp.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_ocsp.c Wed Dec  7 22:33:35 2011
@@ -197,7 +197,7 @@ static int verify_ocsp_status(X509 *cert
                                    &reason, NULL, &thisup, &nextup);
         if (rc != 1) {
             ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, s);
-            ssl_log_cxerror(SSLLOG_MARK, APLOG_ERR, 0, c, cert,
+            ssl_log_cxerror(SSLLOG_MARK, APLOG_ERR, 0, c, cert, APLOGNO(02272)
                             "failed to retrieve OCSP response status");
             rc = V_OCSP_CERTSTATUS_UNKNOWN;
         }
@@ -217,7 +217,7 @@ static int verify_ocsp_status(X509 *cert
                                            sc->server->ocsp_resp_maxage);
             if (vrc != 1) {
                 ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, s);
-                ssl_log_cxerror(SSLLOG_MARK, APLOG_ERR, 0, c, cert,
+                ssl_log_cxerror(SSLLOG_MARK, APLOG_ERR, 0, c, cert, APLOGNO(02273)
                                 "OCSP response outside validity period");
                 rc = V_OCSP_CERTSTATUS_UNKNOWN;
             }

Modified: httpd/httpd/trunk/modules/ssl/ssl_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_util.c?rev=1211680&r1=1211679&r2=1211680&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_util.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_util.c Wed Dec  7 22:33:35 2011
@@ -292,7 +292,7 @@ STACK_OF(X509) *ssl_read_pkcs7(server_re
 
     p7 = PEM_read_PKCS7(f, NULL, NULL, NULL);
     if (!p7) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
+        ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(02274)
                      "Can't read PKCS7 object %s", pkcs7);
         ssl_log_ssl_error(SSLLOG_MARK, APLOG_CRIT, s);
         exit(1);