]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
If Listen directive is not a port, but just an IP, emit an error condition as
authorJustin Erenkrantz <jerenkrantz@apache.org>
Sun, 17 Nov 2002 22:29:14 +0000 (22:29 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Sun, 17 Nov 2002 22:29:14 +0000 (22:29 +0000)
this case is ambiguous.  ('Listen 127.0.0.1' doesn't make any sense.)

(Rich came up with the problem.  Cliff came up with the error text.  Justin
 did the ap_strtol call.)

Reviewed by: Cliff Woolley, Rich Bowen

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@97553 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/main/http_core.c

index 144f3076b161cd94f388cd99cf535ec87bec88cf..1d451ed3568018d44816464946a0b3a396f8b208 100644 (file)
@@ -1,4 +1,9 @@
 Changes with Apache 1.3.28
+
+  *) If Listen directive is not a port, but just an IP, emit an
+     error condition as this case is ambiguous.
+     [Rich Bowen, Justin Erenkrantz, Cliff Woolley]
+
   *) Update timeout algorithm in free_proc_chain. If a subprocess
      did not exit immediately, the thread would sleep for 3 seconds
      before checking the subprocess exit status again. In a very
index 3794f53f919a652861503ed79412850ad37715f7..cbd523b12aff480d56de11f24f5519428ef796ad 100644 (file)
@@ -2596,7 +2596,7 @@ static const char *set_acceptfilter(cmd_parms *cmd, void *dummy, int flag)
 static const char *set_listener(cmd_parms *cmd, void *dummy, char *ips)
 {
     listen_rec *new;
-    char *ports;
+    char *ports, *endptr;
     unsigned short port;
     
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -2626,9 +2626,9 @@ static const char *set_listener(cmd_parms *cmd, void *dummy, char *ips)
     else {
        new->local_addr.sin_addr.s_addr = ap_get_virthost_addr(ips, NULL);
     }
-    port = atoi(ports);
-    if (!port) {
-       return "Port must be numeric";
+    port = ap_strtol(ports, &endptr, 10);
+    if (errno || (endptr && *endptr) || !port) {
+       return "Missing or non-numeric port";
     }
     new->local_addr.sin_port = htons(port);
     new->fd = -1;