From: Tyrel D. <ty...@us...> - 2011-06-08 22:17:26
|
Update of /cvsroot/sblim/cmpi-syslog/syslog-conf/util In directory vz-cvs-3.sog:/tmp/cvs-serv12139/syslog-conf/util Modified Files: syslogconfutil.h syslogsettingparse.c Log Message: Fixed 3287560: Adding rsyslog support for sblim-cmpi-syslog (Patch by Masatake Yamato) Index: syslogconfutil.h =================================================================== RCS file: /cvsroot/sblim/cmpi-syslog/syslog-conf/util/syslogconfutil.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- syslogconfutil.h 19 Aug 2009 00:53:34 -0000 1.7 +++ syslogconfutil.h 8 Jun 2011 22:17:24 -0000 1.8 @@ -23,10 +23,11 @@ #include <time.h> #include <stdio.h> +#include "config.h" -#define LogConfFile "/etc/syslog.conf" -#define ConfFileName "syslog.conf" -#define TmpConfFile "/etc/syslog.conf" +#define LogConfFile SYSLOG_CONF_DIR "/" SYSLOG_CONF_FILE +#define ConfFileName SYSLOG_CONF_FILE +#define TmpConfFile SYSLOG_CONF_DIR "/" SYSLOG_CONF_FILE #define ConfInFile "/tmp/tmpsyslogtest.conf" #define ConfOutFile "/tmp/syslogtest.conf" Index: syslogsettingparse.c =================================================================== RCS file: /cvsroot/sblim/cmpi-syslog/syslog-conf/util/syslogsettingparse.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- syslogsettingparse.c 23 May 2009 02:40:50 -0000 1.9 +++ syslogsettingparse.c 8 Jun 2011 22:17:24 -0000 1.10 @@ -39,7 +39,7 @@ char buf[32]; pid_t pid; - ifp=popen("/sbin/pidof syslogd", "r"); + ifp=popen("/sbin/pidof " SYSLOG_DAEMON, "r"); if ( ifp == NULL ) { syslog_debug(stderr, "Error in sending SIGHUP to syslogd.\n"); @@ -93,7 +93,13 @@ while ( fgets(cline, line_max, fp) != NULL) { for (p = cline; isspace(*p); ++p) ; - if (*p == '\0' || *p == '#') { + if ( + *p == '\0' + || *p == '#' + /* Ignore directive of rsyslog own. + TODO: $IncludeConfig should be handled. */ + || *p == '$' + ) { lineno++; continue; } @@ -136,7 +142,7 @@ } p = strdup((char*)line); - q = strtok(p, "\t"); + q = strtok(p, "\t "); q = strtok(NULL, "\n"); while(isspace(*q)) q++; strcpy(path, q); @@ -229,7 +235,13 @@ while (fgets(cline, line_max, fp) != NULL) { for (p = cline; isspace(*p); ++p); - if (*p == '\0' || *p == '#') { + if ( + *p == '\0' + || *p == '#' + /* Ignore directive of rsyslog own. + TODO: $IncludeConfig should be handled. */ + || *p == '$' + ) { lineno++; new++; continue; @@ -238,7 +250,7 @@ //get path from rule string tmpp = (char*)cline; - tmpq = strtok(tmpp, "\t"); + tmpq = strtok(tmpp, "\t "); tmpq = strtok(NULL, "\n"); while(isspace(*tmpq)) tmpq++; strcpy(tmppath, tmpq); @@ -249,7 +261,7 @@ if (strcmp(tmppath, path)==0) { bzero(tmppath, sizeof(tmppath)); strcpy(cline, p); // copy into new buffer - cline - p = strtok(cline, "\t"); // Get the first token, the filter expression + p = strtok(cline, "\t "); // Get the first token, the filter expression strcpy(cline, p); if (strncmp(action, "create", 6) == 0) { syslog_debug(stderr, "creating / inserting a rule\n"); |