The following reply was made to PR general/2117; it has been noted by GNATS.
From: Marc Slemko <[EMAIL PROTECTED]>
To: "David J. MacKenzie" <[EMAIL PROTECTED]>
Cc: Apache bugs database <[EMAIL PROTECTED]>
Subject: Re: general/2117: The CIDR syntax support for allow and deny finds the
'/' in comments.
Date: Wed, 22 Apr 1998 14:02:47 -0600 (MDT)
On Wed, 22 Apr 1998, David J. MacKenzie wrote:
> On Wed, 22 Apr 1998 13:41:46 -0600 (MDT), Marc Slemko <[EMAIL PROTECTED]>
> said:
>
> > But the problem is that they aren't trailing comments; it just happens
> > that you have specified that access should be allowed from a certain set
> > of hostnames that you think should be a comment, but that Apache knows are
> > just a list of space delimited hostnames. We could special-case the '#'
> > character or do more stringent checks for names that are valid in
> > hostnames, but that can get to be a pain.
>
> Ah, I see! Caught by surprise! Don't special-case '#', but it's
> easy to write a function to tell whether a word could potentially
> be a valid hostname or IP address:
>
> int ap_hostname_syntax(char *s)
> {
> for (; *s; s++) {
> /* Allow : for IPv6. */
> if (!isalnum(*s) && strchr("_-.:", *s) == NULL)
> return 0;
> }
> return 1;
> }
>
> I suggest using that where a valid hostname or IP address is required.
But the complication here is that these can be more than DNS hostnames.
They can be anything that a systems resolver can grok, and some such
routines on some systems allow for less stringent naming rules that can
allow other characters, possibly including '#'; I have no idea offhand.
Isn't life fun.