]> granicus.if.org Git - apache/commitdiff
Prevent Apache from continuing to start when it's encountered a parsing
authorWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 29 Nov 2001 06:56:09 +0000 (06:56 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 29 Nov 2001 06:56:09 +0000 (06:56 +0000)
  error in the Win32 mpm's argv[] review.

  Reported by Grif Rosser <grifr@covalent.net>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92239 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/mpm/winnt/mpm_winnt.c

diff --git a/CHANGES b/CHANGES
index b042e1237d3633d7645258fb224917e717d55a4a..9f1b3cf89c756eb98129f16597ba37271f6dc209 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.30-dev
 
+  *) Prevent the Win32 port from continuing after encountering an
+     error in the command line args to apache.  [William Rowe]
+
   *) On a error in the proxy, make it write a line to the error log
      [Ian Holsman]
 
index 2f0e0a5efae2abc3dfa4998a5cdc8697749c6450..d3ef6daf26598a19182cc2caccf72e4cf19d0d73 100644 (file)
@@ -1691,8 +1691,9 @@ void winnt_rewrite_args(process_rec *process)
     optbuf[0] = '-';
     optbuf[2] = '\0';
     apr_getopt_init(&opt, process->pool, process->argc, (char**) process->argv);
-    while (apr_getopt(opt, "n:k:iu" AP_SERVER_BASEARGS, 
-                      optbuf + 1, &optarg) == APR_SUCCESS) {
+    opt->errfn = NULL;
+    while ((rv = apr_getopt(opt, "n:k:iu" AP_SERVER_BASEARGS, 
+                            optbuf + 1, &optarg)) == APR_SUCCESS) {
         switch (optbuf[1]) {
         case 'n':
             service_set = mpm_service_set_name(process->pool, &service_name, 
@@ -1722,6 +1723,16 @@ void winnt_rewrite_args(process_rec *process)
         }
     }
     
+    /* back up to capture the bad argument */
+    if (rv == APR_BADCH || rv == APR_BADARG) {
+        opt->ind--;
+    }
+
+    while (opt->ind < opt->argc) {
+        *(const char **)apr_array_push(mpm_new_argv) =
+            apr_pstrdup(process->pool, opt->argv[opt->ind++]);
+    }
+
     /* Track the number of args actually entered by the user */
     inst_argc = mpm_new_argv->nelts - fixed_args;