diff options
author | Stefan Fritsch <sf@apache.org> | 2011-12-07 23:33:35 +0100 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2011-12-07 23:33:35 +0100 |
commit | 53164d250f83bcc0eee81ad947f5fc002724e610 (patch) | |
tree | b50f8fc1b985e266be215f67398659feff0db5a9 | |
parent | Remove usage of APLOG_NOERRNO. It has been a no-op since at least 2.0.x (diff) | |
download | apache2-53164d250f83bcc0eee81ad947f5fc002724e610.tar.xz apache2-53164d250f83bcc0eee81ad947f5fc002724e610.zip |
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)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1211680 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | docs/log-message-tags/find-messages.cocci | 61 | ||||
-rw-r--r-- | docs/log-message-tags/next-number | 2 | ||||
-rw-r--r-- | modules/cluster/mod_heartmonitor.c | 5 | ||||
-rw-r--r-- | modules/examples/mod_example_hooks.c | 3 | ||||
-rw-r--r-- | modules/examples/mod_example_ipc.c | 10 | ||||
-rw-r--r-- | modules/proxy/balancers/mod_lbmethod_heartbeat.c | 6 | ||||
-rw-r--r-- | modules/ssl/ssl_engine_init.c | 10 | ||||
-rw-r--r-- | modules/ssl/ssl_engine_kernel.c | 14 | ||||
-rw-r--r-- | modules/ssl/ssl_engine_log.c | 6 | ||||
-rw-r--r-- | modules/ssl/ssl_engine_ocsp.c | 4 | ||||
-rw-r--r-- | modules/ssl/ssl_util.c | 2 |
11 files changed, 92 insertions, 31 deletions
diff --git a/docs/log-message-tags/find-messages.cocci b/docs/log-message-tags/find-messages.cocci index 36db95a9ab..8bcd10f0ec 100644 --- a/docs/log-message-tags/find-messages.cocci +++ b/docs/log-message-tags/find-messages.cocci @@ -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, ...) + + diff --git a/docs/log-message-tags/next-number b/docs/log-message-tags/next-number index 7c81a98af8..184e5a1c8e 100644 --- a/docs/log-message-tags/next-number +++ b/docs/log-message-tags/next-number @@ -1 +1 @@ -2270 +2286 diff --git a/modules/cluster/mod_heartmonitor.c b/modules/cluster/mod_heartmonitor.c index ec12a2a411..8b610e6e79 100644 --- a/modules/cluster/mod_heartmonitor.c +++ b/modules/cluster/mod_heartmonitor.c @@ -684,7 +684,7 @@ static int hm_post_config(apr_pool_t *p, apr_pool_t *plog, 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, apr_pool_t *plog, } 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; } } diff --git a/modules/examples/mod_example_hooks.c b/modules/examples/mod_example_hooks.c index 6f8a1e72a8..743c395065 100644 --- a/modules/examples/mod_example_hooks.c +++ b/modules/examples/mod_example_hooks.c @@ -328,8 +328,7 @@ static x_cfg *our_cconfig(const conn_rec *c) 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); diff --git a/modules/examples/mod_example_ipc.c b/modules/examples/mod_example_ipc.c index 27c87443de..b8ba569c06 100644 --- a/modules/examples/mod_example_ipc.c +++ b/modules/examples/mod_example_ipc.c @@ -141,7 +141,7 @@ static int exipc_post_config(apr_pool_t *pconf, apr_pool_t *plog, */ 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 *pconf, apr_pool_t *plog, 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 *p, server_rec *s) 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 */ diff --git a/modules/proxy/balancers/mod_lbmethod_heartbeat.c b/modules/proxy/balancers/mod_lbmethod_heartbeat.c index 7b4d1b330d..26c8158468 100644 --- a/modules/proxy/balancers/mod_lbmethod_heartbeat.c +++ b/modules/proxy/balancers/mod_lbmethod_heartbeat.c @@ -374,7 +374,7 @@ static int lb_hb_init(apr_pool_t *p, apr_pool_t *plog, 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_pool_t *plog, /* 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) diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c index 79b683cce8..637d35ca85 100644 --- a/modules/ssl/ssl_engine_init.c +++ b/modules/ssl/ssl_engine_init.c @@ -1257,8 +1257,9 @@ static void ssl_init_proxy_certs(server_rec *s, 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_rec *s, } 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++) { diff --git a/modules/ssl/ssl_engine_kernel.c b/modules/ssl/ssl_engine_kernel.c index a3643d9783..e3f48c7af9 100644 --- a/modules/ssl/ssl_engine_kernel.c +++ b/modules/ssl/ssl_engine_kernel.c @@ -1429,7 +1429,7 @@ int ssl_callback_SSLVerify(int ok, X509_STORE_CTX *ctx) * 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_STORE_CTX *ctx) 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_rec *c, 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, X509 **x509, EVP_PKEY **pkey) */ 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, X509 **x509, EVP_PKEY **pkey) /* 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, X509 **x509, EVP_PKEY **pkey) 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); diff --git a/modules/ssl/ssl_engine_log.c b/modules/ssl/ssl_engine_log.c index 271ecc5f79..31861ca721 100644 --- a/modules/ssl/ssl_engine_log.c +++ b/modules/ssl/ssl_engine_log.c @@ -94,7 +94,7 @@ void ssl_log_ssl_error(const char *file, int line, int level, server_rec *s) 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 char *file, int line, int level, */ 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 char *file, int line, int level, } else { apr_snprintf(buf + msglen, sizeof buf - msglen, - APLOGNO(02023) " [certificate: -not available-]"); + " [certificate: -not available-]"); } if (r) { diff --git a/modules/ssl/ssl_engine_ocsp.c b/modules/ssl/ssl_engine_ocsp.c index 4c22b18e3d..b4ea919c4e 100644 --- a/modules/ssl/ssl_engine_ocsp.c +++ b/modules/ssl/ssl_engine_ocsp.c @@ -197,7 +197,7 @@ static int verify_ocsp_status(X509 *cert, X509_STORE_CTX *ctx, conn_rec *c, &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, X509_STORE_CTX *ctx, conn_rec *c, 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; } diff --git a/modules/ssl/ssl_util.c b/modules/ssl/ssl_util.c index 969dab2873..6b5a7de64e 100644 --- a/modules/ssl/ssl_util.c +++ b/modules/ssl/ssl_util.c @@ -292,7 +292,7 @@ STACK_OF(X509) *ssl_read_pkcs7(server_rec *s, const char *pkcs7) 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); |