simplify ServerName check with apr_fnmatch_test()
authorEric Covener <covener@apache.org>
Sat, 4 Dec 2010 12:03:38 +0000 (12:03 +0000)
committerEric Covener <covener@apache.org>
Sat, 4 Dec 2010 12:03:38 +0000 (12:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1042157 13f79535-47bb-0310-9956-ffa450edef68

server/core.c

index f67f084399f00ad8c6ccfeab10bc02f9f1a281f4..c9a74c178502b445a7151901e7ca81466ff6e2a8 100644 (file)
@@ -2354,15 +2354,6 @@ static const char *set_server_string_slot(cmd_parms *cmd, void *dummy,
     return NULL;
 }
 
-
-static 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
@@ -2382,7 +2373,7 @@ static const char *server_hostname_port(cmd_parms *cmd, void *dummy, const char
         return err;
     }
 
-    if (valid_hostname(arg) != APR_SUCCESS)
+    if (apr_fnmatch_test(arg))
         return apr_pstrcat(cmd->temp_pool, "Invalid ServerName \"", arg,
                 "\" use ServerAlias to set multiple server names.", NULL);