httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@lnd.com>
Subject RE: cvs commit: apache-1.3/src CHANGES
Date Sun, 11 Jun 2000 18:17:08 GMT
This is -not- a Win32 post, for those trying to avoid filling their
heads with that drivel :-)  Please read on...

I've been waiting for some space on my overly full plate to look for 
the 'correct' solution to this...

> From: stoddard@locus.apache.org [mailto:stoddard@locus.apache.org]
> Sent: Wednesday, May 24, 2000 12:53 PM
> 
> stoddard    00/05/24 10:53:20
> 
>   Modified:    conf     httpd.conf-dist-win
>                src      CHANGES
>   Log:
>   Win32: Set ServerName to 127.0.0.1 in the default windows httpd.conf file.
>   PR: 5509, 5783, 5953, 5903, 5983, 5259, 5515, 5858
>   
>   Submitted by:	Oliver Wendemuth <owendemuth@ko.hbv.de>
>   
>   Index: httpd.conf-dist-win
>   ===================================================================
>   @@ -230,7 +230,7 @@
>    # You will have to access it by its address (e.g., http://123.45.67.89/)
>    # anyway, and this will make redirections work in a sensible way.
>    #
>   -#ServerName new.host.name
>   +ServerName 127.0.0.1

Why then, doesn't the existing default code work in Win32?

First, MS allows a user to 'name' their machine with a completely bogus
name, and this is what is being retrieved (joes pc would be an example).

Second, ap_get_local_host() has the following code (BEOS path omitted)

    if (gethostname(str, sizeof(str) - 1) != 0) {
	perror("Unable to gethostname");
	exit(1);
    }  // we are good so far...
    str[sizeof(str) - 1] = '\0';
    if ((!(p = gethostbyname(str))) || (!(server_hostname = find_fqdn(a, p)))) {
      // and we land here because find_fdqn fails...
	fprintf(stderr, "%s: cannot determine local host name.\n", ap_server_argv0);

Ok, so digging down into find_fdqn()

    if (!strchr(p->h_name, '.')) {  // we refuse any name sans the '.'s
	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;  // and uneqivocably die here...

so this is no solution.  Two options from here (others may choose):

1) On failure of find_fdqn, return the ip address string -rather than die-

2) Accept bogosity of a non-'.' name with -strong warnings- that the private
   name will not be recognized by the network-at-large, and continue.

In -either- case we will proceed to look for an fdqn, if one is available.

Neither solution is complete - we should be attempting a true reverse-dns
test, but I'll let someone else commit that if it's their desire.

Which solution (or what other solution) can we live with to kill the
explicit ServerName in the 1.3.13 httpd.conf-dist-win?

Bill

Mime
View raw message