Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2012 07:18:00 GMT
From:      Garrett Cooper <yanegomi@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/173930: [patch] syslogd(8) error condition "touchups"
Message-ID:  <201211260718.qAQ7I00x061629@red.freebsd.org>
Resent-Message-ID: <201211260720.qAQ7K0DO004221@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         173930
>Category:       bin
>Synopsis:       [patch] syslogd(8) error condition "touchups"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 26 07:20:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9-STABLE
>Organization:
EMC Isilon
>Environment:
FreeBSD bayonetta.local 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r240836M: Sat Sep 22 12:30:11 PDT 2012     gcooper@bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
>Description:
A couple things:

1. Decoding priorities in cfline incorrectly emits errno information if decoding syslog.conf entries fails.
2. syslogd decodes IPv6 addresses, regardless of whether or not syslogd was compiled with INET6 support.
3. If binding the syslog socket fails, it could mangle the errno value, obfuscating the error returned from bind(2).
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: usr.sbin/syslogd/syslogd.c
===================================================================
--- usr.sbin/syslogd/syslogd.c	(revision 242903)
+++ usr.sbin/syslogd/syslogd.c	(working copy)
@@ -1873,6 +1873,7 @@
 
 			pri = decode(buf, prioritynames);
 			if (pri < 0) {
+				errno = 0;
 				(void)snprintf(ebuf, sizeof ebuf,
 				    "unknown priority name \"%s\"", buf);
 				logerror(ebuf);
@@ -2687,6 +2688,7 @@
 			logerror("socket");
 			continue;
 		}
+#ifdef INET6
 		if (r->ai_family == AF_INET6) {
 			if (setsockopt(*s, IPPROTO_IPV6, IPV6_V6ONLY,
 				       (char *)&on, sizeof (on)) < 0) {
@@ -2695,6 +2697,7 @@
 				continue;
 			}
 		}
+#endif
 		if (setsockopt(*s, SOL_SOCKET, SO_REUSEADDR,
 			       (char *)&on, sizeof (on)) < 0) {
 			logerror("setsockopt");
@@ -2711,8 +2714,8 @@
 		 */
 		if (!NoBind) {
 			if (bind(*s, r->ai_addr, r->ai_addrlen) < 0) {
+				logerror("bind");
 				close(*s);
-				logerror("bind");
 				continue;
 			}
 


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211260718.qAQ7I00x061629>