Date: Thu, 13 Sep 2001 10:50:56 +0300 From: Ruslan Ermilov <ru@FreeBSD.org> To: Dag-Erling Smorgrav <des@FreeBSD.org> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.sbin/syslogd syslogd.c Message-ID: <20010913105056.G10963@sunbay.com> In-Reply-To: <200109130648.f8D6mfU01568@freefall.freebsd.org>; from des@FreeBSD.org on Wed, Sep 12, 2001 at 11:48:41PM -0700 References: <200109130648.f8D6mfU01568@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 12, 2001 at 11:48:41PM -0700, Dag-Erling Smorgrav wrote: > des 2001/09/12 23:48:41 PDT > > Modified files: > usr.sbin/syslogd syslogd.c > Log: > The previous commit appeared to just shove the bug under the carpet rather > than really solve it. This approach (inspired by Ruslan's patch) solves > the real problem by stripping the local domain off the host name in the > config line structure. > Uhh, this actually strips ANY domain part whose length is that of the local domain. The correct patch (only lightly tested) would be: Index: syslogd.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/syslogd/syslogd.c,v retrieving revision 1.89 diff -u -p -r1.89 syslogd.c --- syslogd.c 2001/09/13 06:48:41 1.89 +++ syslogd.c 2001/09/13 07:50:08 @@ -1545,16 +1545,13 @@ cfline(line, f, prog, host) if (host && *host == '*') host = NULL; if (host) { - int hl, dl; - /* XXX should check for NULL return */ f->f_host = strdup(host); - hl = strlen(f->f_host); - if (f->f_host[hl-1] == '.') - f->f_host[--hl] = '\0'; - dl = strlen(LocalDomain) + 1; - if (hl > dl && f->f_host[hl-dl] == '.') - f->f_host[hl-dl] = '\0'; + if (*(bp = f->f_host + strlen(f->f_host) - 1) == '.') + *bp = '\0'; + if ((bp = strchr(f->f_host, '.')) != NULL && + strcasecmp(bp + 1, LocalDomain) == 0) + *bp = '\0'; } /* save program name if any */ Please commit it if you like. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010913105056.G10963>