From: Eric Covener Date: Sat, 4 Dec 2010 12:03:38 +0000 (+0000) Subject: simplify ServerName check with apr_fnmatch_test() X-Git-Tag: 2.3.10~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81ba030297fb43abc856ad68c6d043a61e5851a9;p=thirdparty%2Fapache%2Fhttpd.git simplify ServerName check with apr_fnmatch_test() git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1042157 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/core.c b/server/core.c index f67f084399f..c9a74c17850 100644 --- a/server/core.c +++ b/server/core.c @@ -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);