httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1042098 - in /httpd/httpd/trunk: CHANGES server/core.c
Date Sat, 04 Dec 2010 04:14:04 GMT
Author: covener
Date: Sat Dec  4 04:14:03 2010
New Revision: 1042098

URL: http://svn.apache.org/viewvc?rev=1042098&view=rev
Log:
core: Fail startup when the argument to ServerName looks like a glob
or a regular expression instead of a hostname (*?[]).  PR 39863 

Submitted By: Rahul Nair <rahul.g.nair gmail.com>
Reviewed By: covener


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1042098&r1=1042097&r2=1042098&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Dec  4 04:14:03 2010
@@ -2,6 +2,10 @@
 
 Changes with Apache 2.3.10
 
+  *) core: Fail startup when the argument to ServerName looks like a glob
+     or a regular expression instead of a hostname (*?[]).  PR 39863 
+     [Rahul Nair <rahul.g.nair gmail.com>]
+
   *) mod_userdir: Add merging of enable, disable, and filename arguments 
      to UserDir directive, leaving enable/disable of userlists unmerged. 
      PR 44076 [Eric Covener]

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1042098&r1=1042097&r2=1042098&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Sat Dec  4 04:14:03 2010
@@ -2354,6 +2354,15 @@ static const char *set_server_string_slo
     return NULL;
 }
 
+
+static const apr_status_t valid_hostname(const char* name)
+{
+    if (ap_strchr_c(name, '*') || ap_strchr_c(name, '?') || 
+        ap_strchr_c(name, '[') || ap_strchr_c(name, ']')) { 
+        return APR_EINVAL;
+    }
+    return APR_SUCCESS;
+}
 /*
  * The ServerName directive takes one argument with format
  * [scheme://]fully-qualified-domain-name[:port], for instance
@@ -2373,6 +2382,10 @@ static const char *server_hostname_port(
         return err;
     }
 
+    if (valid_hostname(arg) != APR_SUCCESS)
+        return apr_pstrcat(cmd->temp_pool, "Invalid ServerName \"", arg,
+                "\" use ServerAlias to set multiple server names.", NULL);
+
     part = ap_strstr_c(arg, "://");
 
     if (part) {



Mime
View raw message