]> granicus.if.org Git - apache/commitdiff
Merge r1337344, r1378178, r1397636, r1398025, r1398040, r1398481, r1407004, r1407006...
authorJim Jagielski <jim@apache.org>
Mon, 3 Dec 2012 16:33:42 +0000 (16:33 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 3 Dec 2012 16:33:42 +0000 (16:33 +0000)
* 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

14 files changed:
STATUS
modules/examples/mod_example_hooks.c
modules/generators/mod_autoindex.c
modules/ldap/util_ldap.c
modules/loggers/mod_log_config.c
modules/session/mod_session.c
modules/ssl/ssl_engine_vars.c
server/error_bucket.c
server/protocol.c
server/provider.c
server/util_script.c
server/vhost.c
support/suexec.c
support/win32/ApacheMonitor.c

diff --git a/STATUS b/STATUS
index 9e050cb19ab45f98135d70907f1521aae49f36ca..b4e0c7bdaf3cdf225582a986aa53b3ee89c7a12f 100644 (file)
--- 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
index 743c395065d790afa54b4fe9c91f3a0c7e8b8adb..1c8ca4c1c61788dcb50a58cb072c876f59d41b4b 100644 (file)
@@ -1019,7 +1019,7 @@ static int x_handler(request_rec *r)
             ap_get_server_banner());
     ap_rputs("  <BR>\n", r);
     ap_rprintf(r, "  Server built: \"%s\"\n", ap_get_server_built());
-    ap_rputs("  </P>\n", r);;
+    ap_rputs("  </P>\n", r);
     ap_rputs("  <P>\n", r);
     ap_rputs("  The format for the callback trace is:\n", r);
     ap_rputs("  </P>\n", r);
index 926f8c83a514a67db58c12a3d6e643ea4a56c256..bfcd8114f668a42becbdc6dec67e66d193f8fa9e 100644 (file)
@@ -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
index c7f7b93df1f811254b4dd332766d0a55ea7a1c32..3abeb14e13d93ee16c41ad63a72322570cd0138a 100644 (file)
@@ -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]);
                     }
index bc225cee769445d06bbfacc29f43f16a4ef774b2..31c53db6fb45a07e160be35cdfd72dd7e3eabed9 100644 (file)
@@ -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);
     }
index 7f855c7277c394dd6171e97de695d96345895fb9..a3354a59c4bc1b472af60abd10c88ac518dc16f6 100644 (file)
@@ -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);
index febc176efaba8dae043511228acd813dc956e0bb..223ac9a406005d6e84fad6792ad389604dd7b6c9 100644 (file)
@@ -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;
 }
index d113c171a8dece1fd2993ee8921d74e1f329d762..9c118e6144b56dc30adae16f87b4caea42e872b9 100644 (file)
@@ -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;
index b0da156eec5413925e59c04645bf5785625e02d8..e1ef204900f722476fbd8362bc84c2c0fb20fa7c 100644 (file)
@@ -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'
index a102dd851b11b027c3b0fd7007f17590c03e9aa9..cf307e7c72f8d744c75c215a6345c39291b4261a 100644 (file)
@@ -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);
     }
index ca246dac67953261bac6e3f41c8c38836d9213ac..5708c0860255d5103b517b4bd6c144a24b968110 100644 (file)
@@ -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;
index 302e4084a374b1bc4c4c40f16a07af941c1f78f9..fd7c0ad646d8097a5d9cc34bc731621f78f7a068 100644 (file)
@@ -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;
 }
 
index 5d78bcdb8520de560c95f54a0dd600a3a1c35bf5..2c4e2c3bf0b169fd1ab34cc35b910e6d98a2c031 100644 (file)
@@ -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);
     }
     /*
index de7c64298f304b7810187a5e5973915a5403a07a..c6021f3b19b0b728599aaf045356e9b63722abbc 100644 (file)
@@ -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;