Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 87259 invoked from network); 4 Dec 2010 04:15:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Dec 2010 04:15:41 -0000 Received: (qmail 70528 invoked by uid 500); 4 Dec 2010 04:15:40 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 70337 invoked by uid 500); 4 Dec 2010 04:15:40 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 70330 invoked by uid 99); 4 Dec 2010 04:15:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Dec 2010 04:15:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Dec 2010 04:15:37 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 609FC23888EA; Sat, 4 Dec 2010 04:14:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1042098 - in /httpd/httpd/trunk: CHANGES server/core.c Date: Sat, 04 Dec 2010 04:14:04 -0000 To: cvs@httpd.apache.org From: covener@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101204041404.609FC23888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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 ] + *) 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) {