From 81ba030297fb43abc856ad68c6d043a61e5851a9 Mon Sep 17 00:00:00 2001 From: Eric Covener Date: Sat, 4 Dec 2010 12:03:38 +0000 Subject: [PATCH] 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 --- server/core.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/server/core.c b/server/core.c index f67f084399..c9a74c1785 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); -- 2.40.0