From owner-freebsd-ports Fri Mar 30 17:50: 9 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 7E46437B719 for ; Fri, 30 Mar 2001 17:50:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2V1o1m24642; Fri, 30 Mar 2001 17:50:01 -0800 (PST) (envelope-from gnats) Received: from mail.westbend.net (ns1.westbend.net [216.106.246.3]) by hub.freebsd.org (Postfix) with ESMTP id 6796637B71C for ; Fri, 30 Mar 2001 17:43:38 -0800 (PST) (envelope-from admin@mail.westbend.net) Received: (from root@localhost) by mail.westbend.net (8.11.2/8.11.2) id f2V1hbx63919; Fri, 30 Mar 2001 19:43:37 -0600 (CST) (envelope-from admin) Message-Id: <200103310143.f2V1hbx63919@mail.westbend.net> Date: Fri, 30 Mar 2001 19:43:37 -0600 (CST) From: "Scot W. Hetzel" Reply-To: "Scot W. Hetzel" To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: ports/26237: Apache 1.3.19 segfaulting in ap_get_local_host Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 26237 >Category: ports >Synopsis: Apache 1.3.19 segfaulting in ap_get_local_host >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 30 17:50:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Scot W. Hetzel >Release: FreeBSD 4.2-STABLE i386 >Organization: West Bend Internet >Environment: >Description: Apache Segfaults in ap_get_local_host when ServerName directive is not defined in httpd.conf. >How-To-Repeat: Install apache13, apache13+ipv6, or apache13-modssl and remove the ServerName directive from httpd.conf. >Fix: place the following patch as files/patch-util.c in the apache13, apache13+ipv6, and apache13-modssl ports. apache13-fp is not affected as a similar patch was added a week ago. apache13-ssl < 1.3.19. This patch was obtained from the Apache cvsweb site: http://www.apache.org/websrc/viewcvs.cgi/apache-1.3/src/main/util.c.diff?r1=text&tr1=1.194&r2=text&tr2=1.197&diff_format=u NOTE: Could one of the commiters add this patch before 4.3-RELEASE I have informed the other Apache13* maintainers on this problem, and will inform them of this PR also. --- src/main/util.c 2001/02/01 10:06:37 1.194 +++ src/main/util.c 2001/03/30 17:37:54 1.197 @@ -2013,12 +2013,14 @@ int x; if (!strchr(p->h_name, '.')) { - for (x = 0; p->h_aliases[x]; ++x) { - if (strchr(p->h_aliases[x], '.') && - (!strncasecmp(p->h_aliases[x], p->h_name, strlen(p->h_name)))) - return ap_pstrdup(a, p->h_aliases[x]); - } - return NULL; + if (p->h_aliases) { + for (x = 0; p->h_aliases[x]; ++x) { + if (p->h_aliases[x] && strchr(p->h_aliases[x], '.') && + (!strncasecmp(p->h_aliases[x], p->h_name, strlen(p->h_name)))) + return ap_pstrdup(a, p->h_aliases[x]); + } + } + return NULL; } return ap_pstrdup(a, (void *) p->h_name); } @@ -2040,7 +2042,6 @@ ap_log_error(APLOG_MARK, APLOG_WARNING, NULL, "%s: gethostname() failed to determine ServerName\n", ap_server_argv0); - server_hostname = ap_pstrdup(a, "127.0.0.1"); } else { @@ -2048,14 +2049,14 @@ if ((!(p = gethostbyname(str))) || (!(server_hostname = find_fqdn(a, p)))) { /* Recovery - return the default servername by IP: */ - if (p->h_addr_list[0]) { + if (p && p->h_addr_list && p->h_addr_list[0]) { ap_snprintf(str, sizeof(str), "%pA", p->h_addr_list[0]); server_hostname = ap_pstrdup(a, str); /* We will drop through to report the IP-named server */ } } else - /* Since we found a fdqn, return it with no logged message. */ + /* Since we found a fqdn, return it with no logged message. */ return server_hostname; } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message