Julian Elischer wrote: > Julian Elischer wrote: > >> Does anyone think that this would be useful? >> >> the syslog.conf line would look like: >> >> >> *.* _at_logger.mynet.com:823 > > > Here's a rewritten patch > (against 4.x but the same should apply to current) > > comments? being the first to comment on my own mail, i-- should be --i to leave guaranteed room for '\0'. > > Index: syslogd.c > =================================================================== > RCS file: /usr/local/cvsroot/freebsd/src/usr.sbin/syslogd/syslogd.c,v > retrieving revision 1.59.2.28 > diff -u -r1.59.2.28 syslogd.c > --- syslogd.c 29 Feb 2004 20:59:19 -0000 1.59.2.28 > +++ syslogd.c 17 Apr 2006 07:30:26 -0000 > _at__at_ -1750,13 +1750,32 _at__at_ > > switch (*p) { > case '_at_': > - (void)strlcpy(f->f_un.f_forw.f_hname, ++p, > - sizeof(f->f_un.f_forw.f_hname)); > + { > + char *tp; > + /* > + * scan forward to see if there is a port > defined. > + * so we can't use strlcpy.. > + */ > + i = sizeof(f->f_un.f_forw.f_hname); > + tp = f->f_un.f_forw.f_hname; > + p++; > + > + while (*p && (*p != ':') && (i-- > 0)) { > + *tp++ = *p++; > + } > + *tp = '\0'; > + } > + /* See if we copied a domain and have a port */ > + if (*p == ':') > + p++; > + else > + p = NULL; > + > memset(&hints, 0, sizeof(hints)); > hints.ai_family = family; > hints.ai_socktype = SOCK_DGRAM; > - error = getaddrinfo(f->f_un.f_forw.f_hname, "syslog", > &hints, > - &res); > + error = getaddrinfo(f->f_un.f_forw.f_hname, > + p ? p: "syslog", &hints, &res); > if (error) { > logerror(gai_strerror(error)); > break;Received on Mon Apr 17 2006 - 05:37:45 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:54 UTC