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: more 1.3 ServerName gripes
Date Fri, 07 Jul 2000 13:52:58 GMT
> From: Tony Finch [mailto:dot@dotat.at]
> Sent: Thursday, July 06, 2000 10:15 PM
> 
> OK, maybe my configuration is screwy, but I'm being bitten by this
> code in find_fqdn() in util.c:
> 
>     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;
>     }
>     return ap_pstrdup(a, (void *) p->h_name);
> 
> On my laptop hand.dotat.at I have arranged for the hostname to usually
> resolve to 127.0.0.1 so that things work OK when the net isn't there;
> a reverse lookup of 127.0.0.1 returns the primary name "localhost" and
> the aliases "hand" and "hand.dotat.at". Obviously I would like
> find_fqdn() to return "hand.dotat.at" but the strncasecmp() prevents
> this.
> 
> I want to remove it; can anyone think of a reason why I shouldn't?

Yes... I'd look at a patch like this instead:

    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]);
      }
      for (x = 0; p->h_aliases[x]; ++x) {
        if (strchr(p->h_aliases[x], '.'))
           return ap_pstrdup(a, p->h_aliases[x]);
      }
    }

This way, if you had a localhost.dotat.at - then it would pick it up as
the primary preference.  Since you don't, it will pick up the first dotted
alias it can find.

Mime
View raw message