Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Oct 1998 16:03:30 -0500 (CDT)
From:      Igor Roshchin <igor@physics.uiuc.edu>
To:        stable@FreeBSD.ORG
Subject:   syslogd and syslog.conf
Message-ID:  <199810112103.QAA14342@alecto.physics.uiuc.edu>

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

Those who are reading freebsd-security, already saw this.
For others, briefly:
There was a question and few followups about the syslogd
which doesn't allow to have spaces between the first and the second
field in /etc/syslog.conf .
(this is a feature of syslogd in some (or all ?) other Unices).
Only <tab>s are allowed.

Neither man pages nor anybody of the responders (nor brief analyses of 
the source code) provided any reason why it is essential
to have just tabs, and not any combination of tabs and spaces,
as it is allowed in most (any?) other config files.

So, here is my attempt to implement the desired behavior of syslogd.
This patch allows syslogd to understand both - tabs and spaces
as fields separator in syslog.conf. 
(this seems to be possible, because the first field - selector field
can not contain spaces)
It is Important that this patch should not brake compatibility with
the old ("classical" [?] ) form of syslog.conf, because many people
want to be able to continue using just tabs (including cases with cross-platform
environments).

I tested this syslogd (using the debug mode), and it understands
my syslog.conf, even when I introduced a few spaces instead of tabs
(and mixed them together).
It's been running just fine on a production machine for 4 days by now.

I wonder if somebody can test it on some complicated syslog.conf
(use the debug mode -d) and make sure it doesn't brake on something
which escaped from my sight (especially new features introduced
in later 2.2.x releases)


IgoR



----- Forwarded message from Igor Roshchin -----


Ok, 
don't crash me with your swords .. ;)

I just compiled the syslogd with the changes suggested.
THe diff file is at the bottom.
It works fine for me.
Can anybody else test it against different syslog.conf's ?

My only concern:
In line 1410 - there was a space inside ", ;"  originally:
	while (strchr(", ;", *q))

According to man syslog.conf  - I don't see why it should be there..
This is the moment when the priority is analyzed.
No spaces are allowed before the priority specification.
So, I assume, this was just a typo.
so, it should be 
	while (strchr(",;", *q))
If this is not a typo, but I just missed some meaning, please, correct me!

IgoR

=====================8< ===============================

--- syslogd.c.orig	Thu Aug  6 00:58:10 1998
+++ syslogd.c	Thu Oct  8 22:19:27 1998
@@ -1365,12 +1365,12 @@
 	}
 
 	/* scan through the list of selectors */
-	for (p = line; *p && *p != '\t';) {
+	for (p = line; *p && *p != '\t' && *p != ' ';) {
 		int pri_done;
 		int pri_cmp;
 
 		/* find the end of this facility name list */
-		for (q = p; *q && *q != '\t' && *q++ != '.'; )
+		for (q = p; *q && *q != '\t' && *q != ' ' && *q++ != '.'; )
 			continue;
 
 		/* get the priority comparison */
@@ -1402,12 +1402,12 @@
 				  ;
 
 		/* collect priority name */
-		for (bp = buf; *q && !strchr("\t,;", *q); )
+		for (bp = buf; *q && !strchr("\t,; ", *q); )
 			*bp++ = *q++;
 		*bp = '\0';
 
 		/* skip cruft */
-		while (strchr(", ;", *q))
+		while (strchr(",;", *q))
 			q++;
 
 		/* decode priority name */
@@ -1424,8 +1424,8 @@
 		}
 
 		/* scan facilities */
-		while (*p && !strchr("\t.;", *p)) {
-			for (bp = buf; *p && !strchr("\t,;.", *p); )
+		while (*p && !strchr("\t.; ", *p)) {
+			for (bp = buf; *p && !strchr("\t,;. ", *p); )
 				*bp++ = *p++;
 			*bp = '\0';
 
@@ -1454,7 +1454,7 @@
 	}
 
 	/* skip to action part */
-	while (*p == '\t')
+	while (*p == '\t' || *p == ' ')
 		p++;
 
 	switch (*p)

----- End of forwarded message from Igor Roshchin -----

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message



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