summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2010-12-04 04:14:03 +0000
committerEric Covener <covener@apache.org>2010-12-04 04:14:03 +0000
commitf5d3a4c3f4f59dbbf64020b03ae8bbbd91accbac (patch)
treecb35dd49e9a276a7d3d174d1c3d6e6472d5e56cf /server
parent232506d27ca337fbb5d83dcae4188a78352160a3 (diff)
downloadhttpd-f5d3a4c3f4f59dbbf64020b03ae8bbbd91accbac.tar.gz
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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1042098 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r--server/core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/core.c b/server/core.c
index ffeb98d9dc..7db086f26f 100644
--- a/server/core.c
+++ b/server/core.c
@@ -2354,6 +2354,15 @@ static const char *set_server_string_slot(cmd_parms *cmd, void *dummy,
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(cmd_parms *cmd, void *dummy, const char
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) {