system logging fails due to a bug in parsing

Ilguiz Latypov <[email protected]> Fri, 19 Jul 2002 09:19:18 -0400 (EDT)
Newsgroups gmane.comp.gnu.radius.bugs
Message-ID <[email protected]>
When system logging is enabled with

    logging {
      channel default {
        syslog auth.info;
      }
    }

the related log messages don't show up in syslog files.  Only a message 
about wrong facility/priority 0xffffffff can be seen.

Will the following change fix the problem correctly?  Thanks,

-- 
Ilguiz Latypov
computer programmer
SuperBT Canada, Inc
153 Union St. E.
Waterloo, Ontario N2J 1C4
Canada

GMT-4 day time tel.   +1 (519) 569-7818
GMT-4 night time tel. +1 (519) 569-7193

 
Index: radiusd/log.c
===================================================================
RCS file: /cvsroot/radius/radius/radiusd/log.c,v
retrieving revision 1.36
diff -u -r1.36 log.c
--- radiusd/log.c	8 Jul 2002 16:01:37 -0000	1.36
+++ radiusd/log.c	19 Jul 2002 13:13:41 -0000
@@ -208,8 +208,10 @@
                 
         case LM_SYSLOG:
                 spri = chan->id.prio;
+#if 0
                 if (chan->options & LO_PID)
                         spri |= LOG_PID;
+#endif
                 if (chan->options & LO_TID) 
                         snprintf(buffer, sizeof buffer, "(%#lx): ",
                                  (long) pthread_self());
@@ -926,6 +928,8 @@
 	int facility;
 	int prio;
 	
+	channel.mode = LM_SYSLOG;
+
 	if (argc != 4) {
 		cfg_argc_error(argc < 4);
 		return 0;
@@ -944,24 +948,29 @@
 		return 1;
 	}
 
+        if (facility != -1) {
+	        channel.id.prio = facility;
+        }
+
 	if (argv[2].type != CFG_CHAR || argv[2].v.ch != '.')
 		return 1;
 	
 	switch (argv[3].type) {
 	case CFG_INTEGER:
-		prio = argv[1].v.number;
+		prio = argv[3].v.number;
 		break;
 
 	case CFG_STRING:
-		prio = xlat_keyword(syslog_priority, argv[1].v.string, -1);
+		prio = xlat_keyword(syslog_priority, argv[3].v.string, -1);
 		break;
 
 	default:
 		return 1;
 	}
 
-	channel.mode = LM_SYSLOG;
-	channel.id.prio = facility | prio ;
+        if (prio != -1) {
+	        channel.id.prio = facility | prio;
+        }
 	return 0;
 }