On Fri, Aug 28, 2015 at 07:53:23PM +0200, Alexander Bluhm wrote:
> On Fri, Aug 28, 2015 at 06:11:02PM +0200, Alexander Bluhm wrote:
> > The +host feature allows to select log messages from a specific
> > host.  Normally syslogd does a reverse lookup on the sender's
> > address.  If that fails or if syslogd has been started with the -n
> > option, the +host is matched with the IP.  Unfortunatelty IP addresses
> > consist of characters that are not allowed in syslog.conf.  So take
> > the list of valid characters from FreeBSD.
> 
> Add _ to the list to help people with broken hostnames.
> Suggested by sven falempin.
> 
> ok?
> 
> bluhm
> 
> Index: usr.sbin/syslogd/syslogd.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/syslogd/syslogd.c,v
> retrieving revision 1.179
> diff -u -p -r1.179 syslogd.c
> --- usr.sbin/syslogd/syslogd.c        27 Aug 2015 17:53:35 -0000      1.179
> +++ usr.sbin/syslogd/syslogd.c        28 Aug 2015 17:48:16 -0000
> @@ -2053,12 +2053,14 @@ init(void)
>                               continue;
>                       }
>                       for (i = 0; i < NAME_MAX; i++) {
> -                             if (!isalnum((unsigned char)p[i]) &&
> -                                 p[i] != '-' && p[i] != '+')
> +                             if (!isalnum((unsigned char)*p) &&
> +                                 *p != '-' && *p != '+' && *p != '.' &&
> +                                 *p != ',' && *p != ':' && *p != '%' &&
> +                                 *p != '_')

Does ',' is valid or could occurs in a hostname/ip ?

>                                       break;
> -                             hostblock[i] = p[i];
> +                             hostblock[i] = *p++;
>                       }
> -                     hostblock[i] = 0;
> +                     hostblock[i] = '\0';
>                       continue;
>               }
>  
> 

-- 
Sebastien Marie

Reply via email to