From: Jim Jagielski Date: Mon, 3 Dec 2012 16:33:42 +0000 (+0000) Subject: Merge r1337344, r1378178, r1397636, r1398025, r1398040, r1398481, r1407004, r1407006... X-Git-Tag: 2.4.4~386 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=679d2ece885629ebbc03471be7fb8dd5b55a238c;p=apache Merge r1337344, r1378178, r1397636, r1398025, r1398040, r1398481, r1407004, r1407006, r1407088, r1407528 from trunk: * support/suexec.c: Add gcc format-string attributes to logging functions. (main): Always print uid/gid as unsigned long, and cast to avoid warnings (which somewhat defeats the point of the format string attrs, but is necessary since the size of gid/uid varies). remove an unnecessary check in a nest loop of ap_create_environment() s/;;/;/ No need to test for NULL before calling apr_pstrdup. No need it apr_pcalloc here, the memory is fully initialized the line just after cppCheck: unreadVariable - 'serviceFlag' is not used in the function, so remove it Remove unused code. "Next week" hasn't happened in the last 10 years or so. log client error at level debug, log broken Host header value remove some more old unused code remove obsolete comment from 1.3 days Submitted by: jorton, pqf, jailletc36, jailletc36, jailletc36, jailletc36, sf, sf, sf, sf Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1416581 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 9e050cb19a..b4e0c7bdaf 100644 --- a/STATUS +++ b/STATUS @@ -97,34 +97,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: documentation patch : http://apache-doc-fr.gryzor.com/fallbackresource_disabled_2.4_doc.patch +1: gryzor, covener, sf - * proposal 1/x: try to keep 2.4.x in line with trunk. - Only small and trivial patches. No CHANGES needed IMO (maybe needed for 1407006 ?). - I will propose other ones the same way if you find it interesting. - 1407004: Remove unused code. "Next week" hasn't happened in the last 10 years or so. - 1407528: remove obsolete comment from 1.3 days - 1407088: remove some more old unused code - 1397636: s/;;/;/ - 1378178: remove an unnecessary check in a nest loop of ap_create_environment() - 1407006: log client error at level debug, log broken Host header value - 1337344: support/suexec.c: Add gcc format-string attributes to logging functions. - 1398481: cppCheck: unreadVariable - 'serviceFlag' is not used in the function, so remove it - 1398025: No need to test for NULL before calling apr_pstrdup. - 1398040: No need it apr_pcalloc here, the memory is fully initialized the line just after - trunk patches: - http://svn.apache.org/viewvc?view=revision&revision=1407004 - http://svn.apache.org/viewvc?view=revision&revision=1407528 - http://svn.apache.org/viewvc?view=revision&revision=1407088 - http://svn.apache.org/viewvc?view=revision&revision=1397636 - http://svn.apache.org/viewvc?view=revision&revision=1378178 - http://svn.apache.org/viewvc?view=revision&revision=1407006 - http://svn.apache.org/viewvc?view=revision&revision=1337344 - http://svn.apache.org/viewvc?view=revision&revision=1398481 - http://svn.apache.org/viewvc?view=revision&revision=1398025 - http://svn.apache.org/viewvc?view=revision&revision=1398040 - 2.4.x patch: - http://people.apache.org/~jailletc36/backport.patch - +1: jailletc36, sf, jim - * mod_session_dbd: fix a segmentation fault in the function dbd_remove. PR 53452 trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1408958 diff --git a/modules/examples/mod_example_hooks.c b/modules/examples/mod_example_hooks.c index 743c395065..1c8ca4c1c6 100644 --- a/modules/examples/mod_example_hooks.c +++ b/modules/examples/mod_example_hooks.c @@ -1019,7 +1019,7 @@ static int x_handler(request_rec *r) ap_get_server_banner()); ap_rputs("
\n", r); ap_rprintf(r, " Server built: \"%s\"\n", ap_get_server_built()); - ap_rputs("

\n", r);; + ap_rputs("

\n", r); ap_rputs("

\n", r); ap_rputs(" The format for the callback trace is:\n", r); ap_rputs("

\n", r); diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index 926f8c83a5..bfcd8114f6 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -207,7 +207,7 @@ static void push_item(apr_array_header_t *arr, char *type, const char *to, } p->type = type; - p->data = data ? apr_pstrdup(arr->pool, data) : NULL; + p->data = apr_pstrdup(arr->pool, data); p->apply_path = apr_pstrcat(arr->pool, path, "*", NULL); if ((type == BY_PATH) && (!ap_is_matchexp(to))) { @@ -694,7 +694,7 @@ static void *merge_autoindex_configs(apr_pool_t *p, void *basev, void *addv) * There are local nonincremental settings, which clear * all inheritance from above. They *are* the new base settings. */ - new->opts = add->opts;; + new->opts = add->opts; } /* * We're guaranteed that there'll be no overlap between diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c index c7f7b93df1..3abeb14e13 100644 --- a/modules/ldap/util_ldap.c +++ b/modules/ldap/util_ldap.c @@ -1647,7 +1647,7 @@ static int uldap_cache_checkuserid(request_rec *r, util_ldap_connection_t *ldc, *binddn = apr_pstrdup(r->pool, search_nodep->dn); if (attrs) { int i; - *retvals = apr_pcalloc(r->pool, sizeof(char *) * search_nodep->numvals); + *retvals = apr_palloc(r->pool, sizeof(char *) * search_nodep->numvals); for (i = 0; i < search_nodep->numvals; i++) { (*retvals)[i] = apr_pstrdup(r->pool, search_nodep->vals[i]); } diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c index bc225cee76..31c53db6fb 100644 --- a/modules/loggers/mod_log_config.c +++ b/modules/loggers/mod_log_config.c @@ -1551,7 +1551,7 @@ static void *ap_default_log_writer_init(apr_pool_t *p, server_rec *s, pl = ap_open_piped_log(p, name + 1); if (pl == NULL) { - return NULL;; + return NULL; } return ap_piped_log_write_fd(pl); } diff --git a/modules/session/mod_session.c b/modules/session/mod_session.c index 7f855c7277..a3354a59c4 100644 --- a/modules/session/mod_session.c +++ b/modules/session/mod_session.c @@ -334,7 +334,7 @@ static apr_status_t session_identity_encode(request_rec * r, session_rec * z) apr_table_setn(z->entries, SESSION_EXPIRY, expiry); } apr_table_do((int (*) (void *, const char *, const char *)) - identity_count, &length, z->entries, NULL);; + identity_count, &length, z->entries, NULL); buffer = apr_pcalloc(r->pool, length + 1); apr_table_do((int (*) (void *, const char *, const char *)) identity_concat, buffer, z->entries, NULL); diff --git a/modules/ssl/ssl_engine_vars.c b/modules/ssl/ssl_engine_vars.c index febc176efa..223ac9a406 100644 --- a/modules/ssl/ssl_engine_vars.c +++ b/modules/ssl/ssl_engine_vars.c @@ -496,7 +496,7 @@ static char *ssl_var_lookup_ssl_cert(apr_pool_t *p, request_rec *r, X509 *xs, result = ssl_var_lookup_ssl_cert_PEM(p, xs); } - if (result != NULL && resdup) + if (resdup) result = apr_pstrdup(p, result); return result; } diff --git a/server/error_bucket.c b/server/error_bucket.c index d113c171a8..9c118e6144 100644 --- a/server/error_bucket.c +++ b/server/error_bucket.c @@ -45,7 +45,7 @@ AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error, h = apr_bucket_alloc(sizeof(*h), b->list); h->status = error; - h->data = (buf) ? apr_pstrdup(p, buf) : NULL; + h->data = apr_pstrdup(p, buf); b = apr_bucket_shared_make(b, h, 0, 0); b->type = &ap_bucket_type_error; diff --git a/server/protocol.c b/server/protocol.c index b0da156eec..e1ef204900 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -561,9 +561,6 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb) const char *uri; const char *pro; -#if 0 - conn_rec *conn = r->connection; -#endif int major = 1, minor = 0; /* Assume HTTP/1.0 if non-"HTTP" protocol */ char http[5]; apr_size_t len; @@ -627,20 +624,10 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb) ap_escape_logitem(r->pool, r->the_request)); } - /* we've probably got something to do, ignore graceful restart requests */ - r->request_time = apr_time_now(); ll = r->the_request; r->method = ap_getword_white(r->pool, &ll); -#if 0 -/* XXX If we want to keep track of the Method, the protocol module should do - * it. That support isn't in the scoreboard yet. Hopefully next week - * sometime. rbb */ - ap_update_connection_status(AP_CHILD_THREAD_FROM_ID(conn->id), "Method", - r->method); -#endif - uri = ap_getword_white(r->pool, &ll); /* Provide quick information about the request method as soon as known */ @@ -663,8 +650,6 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb) } r->protocol = apr_pstrmemdup(r->pool, pro, len); - /* XXX ap_update_connection_status(conn->id, "Protocol", r->protocol); */ - /* Avoid sscanf in the common case */ if (len == 8 && pro[0] == 'H' && pro[1] == 'T' && pro[2] == 'T' && pro[3] == 'P' diff --git a/server/provider.c b/server/provider.c index a102dd851b..cf307e7c72 100644 --- a/server/provider.c +++ b/server/provider.c @@ -42,7 +42,7 @@ AP_DECLARE(apr_status_t) ap_register_provider(apr_pool_t *pool, if (global_providers == NULL) { global_providers = apr_hash_make(pool); - global_providers_names = apr_hash_make(pool);; + global_providers_names = apr_hash_make(pool); apr_pool_cleanup_register(pool, NULL, cleanup_global_providers, apr_pool_cleanup_null); } diff --git a/server/util_script.c b/server/util_script.c index ca246dac67..5708c08602 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -122,7 +122,7 @@ AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t) *whack++ = '_'; } while (*whack != '=') { - if (!apr_isalnum(*whack) && *whack != '_') { + if (!apr_isalnum(*whack)) { *whack = '_'; } ++whack; diff --git a/server/vhost.c b/server/vhost.c index 302e4084a3..fd7c0ad646 100644 --- a/server/vhost.c +++ b/server/vhost.c @@ -754,8 +754,9 @@ static void fix_hostname(request_rec *r) bad: r->status = HTTP_BAD_REQUEST; - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00550) - "Client sent malformed Host header"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00550) + "Client sent malformed Host header: %s", + r->hostname); return; } diff --git a/support/suexec.c b/support/suexec.c index 5d78bcdb85..2c4e2c3bf0 100644 --- a/support/suexec.c +++ b/support/suexec.c @@ -128,6 +128,12 @@ static const char *const safe_env_lst[] = NULL }; +static void log_err(const char *fmt,...) + __attribute__((format(printf,1,2))); +static void log_no_err(const char *fmt,...) + __attribute__((format(printf,1,2))); +static void err_output(int is_error, const char *fmt, va_list ap) + __attribute__((format(printf,2,0))); static void err_output(int is_error, const char *fmt, va_list ap) { @@ -263,7 +269,7 @@ int main(int argc, char *argv[]) */ uid = getuid(); if ((pw = getpwuid(uid)) == NULL) { - log_err("crit: invalid uid: (%ld)\n", uid); + log_err("crit: invalid uid: (%lu)\n", (unsigned long)uid); exit(102); } /* @@ -440,7 +446,7 @@ int main(int argc, char *argv[]) * a UID less than AP_UID_MIN. Tsk tsk. */ if ((uid == 0) || (uid < AP_UID_MIN)) { - log_err("cannot run as forbidden uid (%d/%s)\n", uid, cmd); + log_err("cannot run as forbidden uid (%lu/%s)\n", (unsigned long)uid, cmd); exit(107); } @@ -449,7 +455,7 @@ int main(int argc, char *argv[]) * or as a GID less than AP_GID_MIN. Tsk tsk. */ if ((gid == 0) || (gid < AP_GID_MIN)) { - log_err("cannot run as forbidden gid (%d/%s)\n", gid, cmd); + log_err("cannot run as forbidden gid (%lu/%s)\n", (unsigned long)gid, cmd); exit(108); } @@ -460,7 +466,7 @@ int main(int argc, char *argv[]) * and setgid() to the target group. If unsuccessful, error out. */ if (((setgid(gid)) != 0) || (initgroups(actual_uname, gid) != 0)) { - log_err("failed to setgid (%ld: %s)\n", gid, cmd); + log_err("failed to setgid (%lu: %s)\n", (unsigned long)gid, cmd); exit(109); } @@ -468,7 +474,7 @@ int main(int argc, char *argv[]) * setuid() to the target user. Error out on fail. */ if ((setuid(uid)) != 0) { - log_err("failed to setuid (%ld: %s)\n", uid, cmd); + log_err("failed to setuid (%lu: %s)\n", (unsigned long)uid, cmd); exit(110); } @@ -556,11 +562,11 @@ int main(int argc, char *argv[]) (gid != dir_info.st_gid) || (uid != prg_info.st_uid) || (gid != prg_info.st_gid)) { - log_err("target uid/gid (%ld/%ld) mismatch " - "with directory (%ld/%ld) or program (%ld/%ld)\n", - uid, gid, - dir_info.st_uid, dir_info.st_gid, - prg_info.st_uid, prg_info.st_gid); + log_err("target uid/gid (%lu/%lu) mismatch " + "with directory (%lu/%lu) or program (%lu/%lu)\n", + (unsigned long)uid, (unsigned long)gid, + (unsigned long)dir_info.st_uid, (unsigned long)dir_info.st_gid, + (unsigned long)prg_info.st_uid, (unsigned long)prg_info.st_gid); exit(120); } /* diff --git a/support/win32/ApacheMonitor.c b/support/win32/ApacheMonitor.c index de7c64298f..c6021f3b19 100644 --- a/support/win32/ApacheMonitor.c +++ b/support/win32/ApacheMonitor.c @@ -542,7 +542,6 @@ BOOL ApacheManageService(LPCTSTR szServiceName, LPCTSTR szImagePath, { TCHAR szMsg[MAX_PATH]; BOOL retValue; - BOOL serviceFlag = TRUE; SC_HANDLE schService; SC_HANDLE schSCManager; SERVICE_STATUS schSStatus;