You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(23) |
Oct
(2) |
Nov
(1) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(4) |
Feb
(11) |
Mar
(1) |
Apr
(104) |
May
(18) |
Jun
(42) |
Jul
|
Aug
(4) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: <al...@us...> - 2003-04-05 01:57:55
|
Update of /cvsroot/msyslog/syslog/src In directory sc8-pr-cvs1:/tmp/cvs-serv10398 Modified Files: syslogd.c Log Message: align case with switch Index: syslogd.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/syslogd.c,v retrieving revision 1.239 retrieving revision 1.240 diff -u -d -r1.239 -r1.240 --- syslogd.c 5 Apr 2003 01:56:11 -0000 1.239 +++ syslogd.c 5 Apr 2003 01:57:52 -0000 1.240 @@ -286,16 +286,16 @@ */ for (argcnt = 1; (ch = getxopt(argc, argv, " l!list d!debug: i!input: " - "f!conf: m!markinterval: P!pidfile: c!console A!localdomain " - "n!nodefault C!nocollapse h!help u!udp p!path a!add", &argcnt)) - != -1; argcnt++) { + "f!conf: m!markinterval: P!pidfile: c!console A!localdomain " + "n!nodefault C!nocollapse h!help u!udp p!path a!add", &argcnt)) + != -1; argcnt++) { char buf[512]; switch (ch) { - case 'l': /* listing of files/directories etc. */ + case 'l': /* listing of files/directories etc. */ globals.FileListing = argv[argcnt]; break; - case 'd': /* debug */ + case 'd': /* debug */ if (argcnt >= argc || *argv[argcnt] == '-' || !isdigit((int) *argv[argcnt])) { /* missing level */ @@ -307,50 +307,50 @@ if (main_lib == NULL) main_lib = dlopen("./" MLIBNAME_STR, DLOPEN_FLAGS); break; - case 'f': /* configuration file */ + case 'f': /* configuration file */ ConfFile = argv[argcnt]; break; - case 'm': /* mark interval */ + case 'm': /* mark interval */ MarkInterval = strtol(argv[argcnt], NULL, 10) * 60; break; - case 'u': /* allow udp input port */ + case 'u': /* allow udp input port */ if (imodule_create(&Inputs, "udp") < 0) { fprintf(stderr, "syslogd: WARNING error on " "udp input module\n"); } break; - case 'i': /* inputs */ + case 'i': /* inputs */ if (imodule_create(&Inputs, argv[argcnt]) < 0) { fprintf(stderr, "syslogd: WARNING error on " "input module, ignoring %s\n", argv[argcnt]); } break; - case 'p': /* path */ - case 'a': /* additional im_unix socket */ + case 'p': /* path */ + case 'a': /* additional im_unix socket */ snprintf(buf, sizeof(buf), "unix %s", argv[argcnt]); if (imodule_create(&Inputs, buf) < 0) { fprintf(stderr, "syslogd: WARNING out of " "descriptors, %s ignored\n", argv[argcnt]); } break; - case 'c': /* don't use console */ + case 'c': /* don't use console */ UseConsole = 0; break; - case 'n': /* don't start default modules */ + case 'n': /* don't start default modules */ default_inputs = 0; break; - case 'P': /* alternate pidfile */ + case 'P': /* alternate pidfile */ pidfile = argv[argcnt]; break; - case 'A': /* use local domain name too */ + case 'A': /* use local domain name too */ DaemonFlags |= USE_LOCALDOMAIN; break; case 'C': DaemonFlags |= DONT_COLLAPSE; break; - case 'h': - default: + case 'h': + default: usage(); } } @@ -409,12 +409,12 @@ /* go daemon and mimic daemon() */ switch (fork()) { - case -1: + case -1: perror("fork"); exit(-1); - case 0: + case 0: break; - default: + default: exit(0); } @@ -587,14 +587,14 @@ switch (count = poll(poll_fd, poll_fd_cnt, (unpoll_fd_cnt ? poll_timeout : -1))) { /* error */ - case -1: + case -1: m_dprintf(MSYSLOG_INFORMATIVE, "syslogd: poll error: [%d]\n", errno); if (errno != EINTR) logerror("poll"); break; /* timeout */ - case 0: + case 0: for (ix = 0; ix < unpoll_fd_cnt; ix++) { struct i_module *current = unpoll_fd_modules[ix]; @@ -624,7 +624,7 @@ break; /* When file descriptors have events */ - default: + default: m_dprintf(MSYSLOG_INFORMATIVE, "syslogd: [%d] poll events\n", count); for (ix = 0; ix < poll_fd_cnt || count < 1; ix++) { struct i_module *current = poll_fd_modules[ix]; @@ -677,7 +677,7 @@ printline(log.im_host, log.im_msg, log.im_len, current->im_flags); } else if (val == 0) { } - /* input module logged the messages, or none need be logged */ + /* input module logged the messages, or none need be logged */ else if (val > 1) { } /* more than one message to print? not * currently supported */ @@ -1281,7 +1281,7 @@ f = NULL; strncpy(prog, "*", 2); - prog[sizeof (prog) - 1] = '\0'; + prog[sizeof(prog) - 1] = '\0'; while (fgets(cline, sizeof(cline), cf) != NULL) { int clen; @@ -1317,7 +1317,7 @@ p++; if (!*p) { strncpy(prog, "*", 2); - prog[sizeof (prog) - 1] = '\0'; + prog[sizeof(prog) - 1] = '\0'; continue; } for (i = 0; i < NAME_MAX; i++) { @@ -1672,7 +1672,7 @@ /* do we need bigger arrays? */ switch (type) { - case 'p': /* pollable */ + case 'p': /* pollable */ if (poll_fd_cnt % 50 == 0) { @@ -1698,7 +1698,7 @@ break; - case 'u': /* unpollable */ + case 'u': /* unpollable */ if (unpoll_fd_cnt % 50 == 0) { @@ -1723,7 +1723,7 @@ break; - default: + default: } return (1); @@ -1739,7 +1739,7 @@ switch (type) { /* determine the index by searching for the file descriptor */ - case 'p': /* pollable */ + case 'p': /* pollable */ for (ix = 0; ix < poll_fd_cnt && poll_fd[ix].fd != fd; ix++); if (ix == poll_fd_cnt || fd != poll_fd[ix].fd) return; /* not found */ @@ -1754,7 +1754,7 @@ break; - case 'u': /* unpollable */ + case 'u': /* unpollable */ for (ix = 0; ix < unpoll_fd_cnt && unpoll_fd[ix] != fd; ix++); if (ix == unpoll_fd_cnt || fd != unpoll_fd[ix]) return; /* not found */ @@ -1768,7 +1768,7 @@ break; - default: + default: } } @@ -1777,10 +1777,10 @@ signal_handler(int signo) { switch (signo) { - case SIGTSTP: + case SIGTSTP: raise(SIGSTOP); break; - default:; + default:; } } |
From: <al...@us...> - 2003-04-05 01:56:14
|
Update of /cvsroot/msyslog/syslog/src In directory sc8-pr-cvs1:/tmp/cvs-serv9518/src Modified Files: syslogd.c Log Message: -C option to avoid repeated msg to collapse by jkohen@ Index: syslogd.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/syslogd.c,v retrieving revision 1.238 retrieving revision 1.239 diff -u -d -r1.238 -r1.239 --- syslogd.c 4 Apr 2003 20:04:28 -0000 1.238 +++ syslogd.c 5 Apr 2003 01:56:11 -0000 1.239 @@ -186,6 +186,7 @@ #define SYSLOGD_MARK 0x02 /* call domark() */ #define SYSLOGD_DIE 0x04 /* call die() */ #define USE_LOCALDOMAIN 0x08 /* use hostname with local domain */ +#define DONT_COLLAPSE 0x10 char *libdir = NULL; struct global globals = {NULL, NULL, NULL}; @@ -277,20 +278,17 @@ * -c -noconsole * -A -uselocaldomain * -n -nodefault + * -C -nocollapse * * legacy options * -u -unix * -p -path -a [additional unix input module in /dev/log] */ - for (argcnt = 1; /* skip argv[0] getxopt() */ - ((ch = getxopt(argc, argv, - " l!list" - " d!debug: i!input: f!conf:" - " m!markinterval: P!pidfile: c!console A!localdomain" - " n!nodefault h!help" - " u!udp p!path a!add", &argcnt)) != -1); - argcnt++) { + for (argcnt = 1; (ch = getxopt(argc, argv, " l!list d!debug: i!input: " + "f!conf: m!markinterval: P!pidfile: c!console A!localdomain " + "n!nodefault C!nocollapse h!help u!udp p!path a!add", &argcnt)) + != -1; argcnt++) { char buf[512]; switch (ch) { @@ -347,6 +345,10 @@ case 'A': /* use local domain name too */ DaemonFlags |= USE_LOCALDOMAIN; break; + case 'C': + DaemonFlags |= DONT_COLLAPSE; + break; + case 'h': default: usage(); @@ -691,7 +693,7 @@ "Modular Syslog vesion " MSYSLOG_VERSION_STR "\n\n" "usage: syslogd [-d <debug_level>] [-u] [-f conffile] " "[-P pidfile] [-n] [-m markinterval] \\\n [-p logpath] " - "[-a logpath] -i input1 [-i input2] [-i inputn]\n %s\n" + "[-a logpath] [-C] -i input1 [-i input2] [-i inputn]\n %s\n" "%s\n\n", copyright, rcsid); exit(1); } @@ -905,9 +907,11 @@ /* * suppress duplicate lines to this file */ - if ((flags & MARK) == 0 && msglen == f->f_prevlen && + if (!(DaemonFlags & DONT_COLLAPSE) && + !(flags & MARK) && msglen == f->f_prevlen && !strcmp(msg, f->f_prevline) && !strcmp(from, f->f_prevhost)) { + memcpy(&f->f_tm, ×tamp, sizeof(f->f_tm)); f->f_prevcount++; m_dprintf(MSYSLOG_INFORMATIVE, "msg repeated %d times," |
From: <al...@us...> - 2003-04-05 00:40:39
|
Update of /cvsroot/msyslog/syslog/src In directory sc8-pr-cvs1:/tmp/cvs-serv20020/src Modified Files: modules.h Log Message: add ifndef to make things a bit better. tho this still shouldnt be dup Index: modules.h =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules.h,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- modules.h 5 Apr 2003 00:05:17 -0000 1.52 +++ modules.h 5 Apr 2003 00:40:35 -0000 1.53 @@ -40,7 +40,9 @@ /* this MUST be the same value as syslogd.h */ -#define MAXLINE 4096 +#ifndef MAXLINE +# define MAXLINE 4096 +#endif #define MAX_MODULE_NAME_LEN 255 |
From: <al...@us...> - 2003-04-05 00:06:06
|
Update of /cvsroot/msyslog/syslog/src In directory sc8-pr-cvs1:/tmp/cvs-serv9917 Modified Files: syslogd.h Log Message: raise MAXLINE to 4096 jkohen@ Index: syslogd.h =================================================================== RCS file: /cvsroot/msyslog/syslog/src/syslogd.h,v retrieving revision 1.112 retrieving revision 1.113 diff -u -d -r1.112 -r1.113 --- syslogd.h 8 Jan 2003 16:02:48 -0000 1.112 +++ syslogd.h 5 Apr 2003 00:06:03 -0000 1.113 @@ -43,7 +43,7 @@ # endif #endif -#define MAXLINE 2048 /* maximum line length */ +#define MAXLINE 4096 /* maximum line length */ #define MAXSVLINE 120 /* maximum saved line length */ #define DEFUPRI (LOG_USER|LOG_NOTICE) #define DEFSPRI (LOG_KERN|LOG_CRIT) |
From: <al...@us...> - 2003-04-05 00:05:21
|
Update of /cvsroot/msyslog/syslog/src In directory sc8-pr-cvs1:/tmp/cvs-serv9498 Modified Files: modules.h Log Message: raise MAXLINE to 4096 jkohen@ Index: modules.h =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules.h,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- modules.h 25 Sep 2002 22:50:16 -0000 1.51 +++ modules.h 5 Apr 2003 00:05:17 -0000 1.52 @@ -40,7 +40,7 @@ /* this MUST be the same value as syslogd.h */ -#define MAXLINE 2048 +#define MAXLINE 4096 #define MAX_MODULE_NAME_LEN 255 |
From: <al...@us...> - 2003-04-04 21:49:00
|
Update of /cvsroot/msyslog/syslog In directory sc8-pr-cvs1:/tmp/cvs-serv13874 Modified Files: AUTHORS Log Message: nowadays Index: AUTHORS =================================================================== RCS file: /cvsroot/msyslog/syslog/AUTHORS,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- AUTHORS 24 Sep 2002 19:34:29 -0000 1.5 +++ AUTHORS 4 Apr 2003 21:48:53 -0000 1.6 @@ -8,13 +8,12 @@ Eric Allman then did more extensive changes The NetBSD project (www.netbsd.org) adapted it The OpenBSD project(www.openbsd.org) project did a security audit and adapted it -Alejo Sanchez (al...@co...) developed Modular Syslog for Core-SDI -general coding specially autoconf, sql support, dynamic library use. +Alejo Sanchez (al...@co...) developed Modular Syslog for Core-SDI general coding specially autoconf, sql support, dynamic library use. Federico Schwindt (fg...@co...) did configure Claudio Castiglia (cl...@co...) did makefile work, peo and linux module. The Core-SDI consulting project did security audit for msyslog 1.0 +Javier Kohen (jk...@co...) did bug fixes +Florin Andrei (fl...@sg...) helped debug and improve the project +Fredrick Paul Eisele (ph...@ne...) did more modules and general fixing -Current Msyslog mantainer/developer is Alejo Sanchez (but no longer for CoreSDI) - -Fredrick Paul Eisele (ph...@ne...) joined the team and did more modules and general fixing -Florin Andrei (fl...@sg...) joined the team long ago, and helped debug and improve the project +Current Msyslog mantainer/developer is Alejo Sanchez |
From: <al...@us...> - 2003-04-04 20:14:54
|
Update of /cvsroot/msyslog/syslog/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv6225/modules Modified Files: om_queue.c om_regex.c Log Message: warn. string mgmt on these modules is complicated. thorough revisions required Index: om_queue.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/om_queue.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- om_queue.c 4 Apr 2003 17:22:25 -0000 1.7 +++ om_queue.c 4 Apr 2003 20:14:50 -0000 1.8 @@ -147,6 +147,7 @@ *swap2 = '\0'; while( ( new_position = strchr(position, to_encode) ) != 0 ) { +#warning are you sure this is correct ? strncat(swap2, position, new_position - position); strcat(swap2, encoding); position = new_position + 1; Index: om_regex.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/om_regex.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- om_regex.c 4 Apr 2003 18:38:26 -0000 1.50 +++ om_regex.c 4 Apr 2003 20:14:50 -0000 1.51 @@ -354,6 +354,7 @@ *subexp_no = realloc( *subexp_no, current_bound * sizeof(int) ); } (*non_subst)[current_element] = malloc(pmatch[3].rm_so); +#warning are you sure this is correct ? strncpy((*non_subst)[current_element], start, pmatch[3].rm_so - 1); (*non_subst)[current_element][pmatch[3].rm_so - 1] = '\0'; unbackslash((*non_subst)[current_element]); |
From: <al...@us...> - 2003-04-04 20:12:41
|
Update of /cvsroot/msyslog/syslog/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv5529/modules Modified Files: om_classic.c Log Message: proper string mgmt, even from config other assumed size prev defined, but this way is less error prone Index: om_classic.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/om_classic.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -r1.92 -r1.93 --- om_classic.c 6 Jan 2003 23:17:39 -0000 1.92 +++ om_classic.c 4 Apr 2003 20:12:37 -0000 1.93 @@ -341,7 +341,7 @@ strncpy(c->f_un.f_forw.f_hname, ++p, sizeof(c->f_un.f_forw.f_hname) - 1); - c->f_un.f_forw.f_hname[sizeof(c->f_un.f_forw.f_hname) - 1] + c->f_un.f_forw.f_hname[sizeof (c->f_un.f_forw.f_hname) - 1] = '\0'; if ((sa = resolv_name(c->f_un.f_forw.f_hname, "syslog", "udp", @@ -363,8 +363,8 @@ p++; case '|': /* from sysklogd */ case '/': - strncpy(c->f_un.f_fname, p, sizeof c->f_un.f_fname); - c->f_un.f_fname[sizeof (c->f_un.f_fname) - 1] = 0; + strncpy(c->f_un.f_fname, p, sizeof (c->f_un.f_fname) - 1); + c->f_un.f_fname[sizeof (c->f_un.f_fname) - 1] = '\0'; if ( *p == '|' ) { if (global->flist_des) { @@ -410,9 +410,13 @@ default: for (i = 0; i < MAXUNAMES && *p; i++) { + for (q = p; *q && *q != ','; ) q++; - (void)strncpy(c->f_un.f_uname[i], p, UT_NAMESIZE); + + strncpy(c->f_un.f_uname[i], p, sizeof (c->f_un.f_uname[0]) - 1); + c->f_un.f_uname[i][sizeof (c->f_un.f_uname[0]) - 1] = '\0'; + if ((q - p) > UT_NAMESIZE) c->f_un.f_uname[i][UT_NAMESIZE] = '\0'; else @@ -496,8 +500,9 @@ #endif continue; - strncpy(line, ut.ut_line, sizeof(ut.ut_line)); - line[sizeof(ut.ut_line)] = '\0'; + strncpy(line, ut.ut_line, sizeof (line) - 1); + line[sizeof (line) - 1] = '\0'; + if (c->f_type == F_WALL) { if ((p = ttymsg(iov, 6, line, TTYMSGTIME)) != NULL) { errno = 0; /* already in msg */ @@ -506,6 +511,7 @@ } continue; } + /* should we send the message to this user? */ for (i = 0; i < MAXUNAMES; i++) { if (!c->f_un.f_uname[i][0]) |
From: <al...@us...> - 2003-04-04 20:09:16
|
Update of /cvsroot/msyslog/syslog/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv4359/modules Modified Files: im_unix.c Log Message: proper string mgmt, even if it's from cmdline Index: im_unix.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/im_unix.c,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- im_unix.c 17 Sep 2002 05:20:28 -0000 1.56 +++ im_unix.c 4 Apr 2003 20:09:11 -0000 1.57 @@ -89,7 +89,10 @@ memset(&sunx, 0, sizeof(sunx)); sunx.sun_family = AF_UNIX; - (void)strncpy(sunx.sun_path, logger, sizeof(sunx.sun_path)); + + strncpy(sunx.sun_path, logger, sizeof(sunx.sun_path) - 1); + sunx.sun_path[sizeof (sunx.sun_path) - 1] = '\0'; + I->im_fd = socket(AF_UNIX, SOCK_DGRAM, 0); if (I->im_fd < 0 || bind(I->im_fd, (struct sockaddr *)&sunx, SUN_LEN(&sunx)) < 0 || |
From: <al...@us...> - 2003-04-04 20:06:55
|
Update of /cvsroot/msyslog/syslog/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv3585/modules Modified Files: im_file.c Log Message: indent within comment (blah) ignore Index: im_file.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/im_file.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- im_file.c 22 Feb 2003 03:40:58 -0000 1.9 +++ im_file.c 4 Apr 2003 20:06:51 -0000 1.10 @@ -359,10 +359,10 @@ /* put the hostname into the message */ /* - strncat(ret->im_msg, c->name, + strncat(ret->im_msg, c->name, sizeof(ret->im_msg) - strlen(ret->im_msg) - 1); strncat(ret->im_msg, ":", - sizeof(ret->im_msg) - strlen(ret->im_msg) - 1); + sizeof(ret->im_msg) - strlen(ret->im_msg) - 1); m_dprintf(MSYSLOG_INFORMATIVE, "im_file_read: reformed header: [%s]\n", ret->im_msg); */ |
From: <al...@us...> - 2003-04-04 20:04:33
|
Update of /cvsroot/msyslog/syslog/src In directory sc8-pr-cvs1:/tmp/cvs-serv2499 Modified Files: syslogd.c Log Message: add termination even if it's redundant (so searching for bugs don't bring them up) Index: syslogd.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/syslogd.c,v retrieving revision 1.237 retrieving revision 1.238 diff -u -d -r1.237 -r1.238 --- syslogd.c 4 Apr 2003 18:21:57 -0000 1.237 +++ syslogd.c 4 Apr 2003 20:04:28 -0000 1.238 @@ -1275,7 +1275,10 @@ * Foreach line in the conf table, open that file. */ f = NULL; + strncpy(prog, "*", 2); + prog[sizeof (prog) - 1] = '\0'; + while (fgets(cline, sizeof(cline), cf) != NULL) { int clen; @@ -1310,6 +1313,7 @@ p++; if (!*p) { strncpy(prog, "*", 2); + prog[sizeof (prog) - 1] = '\0'; continue; } for (i = 0; i < NAME_MAX; i++) { |
From: <al...@us...> - 2003-04-04 19:16:57
|
Update of /cvsroot/msyslog/syslog/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv16134 Modified Files: om_mysql.c Log Message: minimal style Index: om_mysql.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/om_mysql.c,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -r1.84 -r1.85 --- om_mysql.c 17 Sep 2002 05:20:28 -0000 1.84 +++ om_mysql.c 4 Apr 2003 19:16:48 -0000 1.85 @@ -108,7 +108,8 @@ char facility[16], priority[16], *p; int i; RETSIGTYPE (*sigsave)(int); - m->fired++; + + m->fired++; m_dprintf(MSYSLOG_INFORMATIVE, "om_mysql_write: entering [%s] [%s]\n", m->msg, f->f_prevline); |
From: <al...@us...> - 2003-04-04 18:38:31
|
Update of /cvsroot/msyslog/syslog/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv31508/src/modules Modified Files: om_regex.c Log Message: warn. but anyway this module sucks in current state. Index: om_regex.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/om_regex.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- om_regex.c 1 Oct 2002 19:37:39 -0000 1.49 +++ om_regex.c 4 Apr 2003 18:38:26 -0000 1.50 @@ -468,13 +468,16 @@ int ix; +#warning FIX THIS strncpy(new_string, *non_subst++, MAXLINE+1); for(ix = 0 ; ix < no_subst ; ++ix) { char length = pmatch[*subexp_no].rm_eo - pmatch[*subexp_no].rm_so; char *start = string + pmatch[*subexp_no++].rm_so; +#warning FIX THIS strncat( new_string, start, min( length, MAXLINE+1 - strlen(new_string) ) ); +#warning FIX THIS strncat( new_string, *non_subst++, MAXLINE+1 - strlen(new_string) ); } @@ -487,6 +490,7 @@ case OM_FILTER_HOST: memset(f->f_prevhost, '\0', MAXHOSTNAMELEN); +#warning FIX THIS strncpy(f->f_prevhost, new_string, MAXHOSTNAMELEN - 1); break; } |
From: <al...@us...> - 2003-04-04 18:37:35
|
Update of /cvsroot/msyslog/syslog In directory sc8-pr-cvs1:/tmp/cvs-serv31144 Modified Files: configure configure.in Log Message: queue module disabled by default for now Index: configure =================================================================== RCS file: /cvsroot/msyslog/syslog/configure,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- configure 1 Apr 2003 21:07:24 -0000 1.93 +++ configure 4 Apr 2003 18:37:21 -0000 1.94 @@ -1,81 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57. +# Generated by Autoconf 2.52. # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## --------------------- ## [...7806 lines suppressed...] chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save - # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open @@ -7818,11 +5934,8 @@ # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + $SHELL $CONFIG_STATUS || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. Index: configure.in =================================================================== RCS file: /cvsroot/msyslog/syslog/configure.in,v retrieving revision 1.156 retrieving revision 1.157 diff -u -d -r1.156 -r1.157 --- configure.in 25 Nov 2002 17:03:56 -0000 1.156 +++ configure.in 4 Apr 2003 18:37:27 -0000 1.157 @@ -431,10 +431,12 @@ MSRCS="$MSRCS om_queue.c om_directory.c" MANPAGES="$MANPAGES om_directory.8" fi -],[ - MSRCS="$MSRCS om_queue.c om_directory.c" - MANPAGES="$MANPAGES om_directory.8" -]) +] +dnl ,[ +dnl MSRCS="$MSRCS om_queue.c om_directory.c" +dnl MANPAGES="$MANPAGES om_directory.8" +dnl ] +) AC_ARG_WITH(refract, [ --without-refract |
From: <al...@us...> - 2003-04-04 18:26:01
|
Update of /cvsroot/msyslog/syslog/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv26474/src/modules Modified Files: im_bsd.c Log Message: remove assert() Index: im_bsd.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/im_bsd.c,v retrieving revision 1.87 retrieving revision 1.88 diff -u -d -r1.87 -r1.88 --- im_bsd.c 22 Feb 2003 03:40:58 -0000 1.87 +++ im_bsd.c 4 Apr 2003 18:25:55 -0000 1.88 @@ -92,7 +92,6 @@ char *p, *q, *lp; int i, c; - assert(sizeof (ret->im_msg) >= sizeof (_PATH_UNIX ": ")); snprintf(ret->im_msg, sizeof (ret->im_msg), _PATH_UNIX ": "); lp = ret->im_msg + strlen(ret->im_msg); |
From: <al...@us...> - 2003-04-04 18:22:09
|
Update of /cvsroot/msyslog/syslog/src In directory sc8-pr-cvs1:/tmp/cvs-serv24951 Modified Files: syslogd.c Log Message: indent -l79 -br -ci4 -cli0.5 -i8 -lp syslogd.c Index: syslogd.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/syslogd.c,v retrieving revision 1.236 retrieving revision 1.237 diff -u -d -r1.236 -r1.237 --- syslogd.c 22 Mar 2003 15:41:41 -0000 1.236 +++ syslogd.c 4 Apr 2003 18:21:57 -0000 1.237 @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id$ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -34,15 +34,15 @@ */ #ifndef lint -static char copyright[] = +static char copyright[] = [...3018 lines suppressed...] { - int ret; - va_list var; + int ret; + va_list var; - if (level >= Debug) -return (1); + if (level >= Debug) + return (1); - va_start(var, fmt); - ret = vfprintf(stderr, fmt, var); - va_end(var); -return(ret); + va_start(var, fmt); + ret = vfprintf(stderr, fmt, var); + va_end(var); + return (ret); } |
From: <ph...@us...> - 2003-04-04 17:22:32
|
Update of /cvsroot/msyslog/syslog/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv2565/syslog/src/modules Modified Files: im_tcp.c im_udp.c om_queue.c Log Message: While complient with RFC 3164 the host parsing is not appropriate when the timestamp is missing but the priority is not. Index: im_tcp.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/im_tcp.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- im_tcp.c 22 Feb 2003 03:40:58 -0000 1.44 +++ im_tcp.c 4 Apr 2003 17:22:24 -0000 1.45 @@ -386,8 +386,8 @@ &n1, host, &n2) != 1 && sscanf(thisline, "%*3s %*i %*i:%*i:%*i %n%89s %n", &n1, host, &n2) != 1 && - sscanf(thisline, "%n%89s %n", - &n1, host, &n2) != 1) + sscanf(ret->im_msg, "<%*d>%n%89s %n%*s", &n1, host, &n2) != 1 && + sscanf(thisline, "%n%89s %n", &n1, host, &n2) != 1) || im->im_buf[n2] == '\0') { m_dprintf(MSYSLOG_INFORMATIVE, Index: im_udp.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/im_udp.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -d -r1.81 -r1.82 --- im_udp.c 1 Apr 2003 21:07:26 -0000 1.81 +++ im_udp.c 4 Apr 2003 17:22:24 -0000 1.82 @@ -209,10 +209,11 @@ int n1 = 0; int n2 = 0; - if ((sscanf(ret->im_msg, "<%*d>%*3s %*i %*i:%*i:%*i %n%89s " - "%n%*s", &n1, host, &n2) != 1 + if ((sscanf(ret->im_msg, "<%*d>%*3s %*i %*i:%*i:%*i %n%89s %n%*s", + &n1, host, &n2) != 1 && sscanf(ret->im_msg, "%*3s %*i %*i:%*i:%*i %n%89s %n%*s", - &n1, host, &n2) != 1 + &n1, host, &n2) != 1 + && sscanf(ret->im_msg, "<%*d>%n%89s %n%*s", &n1, host, &n2) != 1 && sscanf(ret->im_msg, "%n%89s %n%*s", &n1, host, &n2) != 1) || ret->im_msg[n2] == '\0') { Index: om_queue.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/om_queue.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- om_queue.c 26 Sep 2002 18:46:07 -0000 1.6 +++ om_queue.c 4 Apr 2003 17:22:25 -0000 1.7 @@ -115,6 +115,51 @@ struct om_queue_element_node *footer_node; /* the first footer's node */ }; +struct xml_encoding { + char to_encode; + char encoding[16]; +}; + +static struct xml_encoding encodings[] = { + { '&', "&" }, /* AMPERSAND **MUST** GO FIRST !! */ + { '<', "<" }, + { '>', ">" }, +}; + +static int no_encodings = sizeof(encodings)/sizeof(encodings[0]); + +static char *xml_encode(char *from, char *to, int to_length) { + int to1_length = strlen(from) * 6; + char to1[to1_length], to2[to1_length]; + + char *swap1 = to1, *swap2 = to2; + int ix; + + strcpy(swap1, from); + for(ix = 0 ; ix < no_encodings ; ++ix) { + + char to_encode = encodings[ix].to_encode; + char *encoding = encodings[ix].encoding; + + char *position = swap1, *new_position; + char *swapper; + + *swap2 = '\0'; + + while( ( new_position = strchr(position, to_encode) ) != 0 ) { + strncat(swap2, position, new_position - position); + strcat(swap2, encoding); + position = new_position + 1; + } + strcat(swap2, position); + + swapper = swap1; swap1 = swap2; swap2 = swapper; + } + + strncpy(to, swap1, to_length); to[to_length - 1] = '\0'; + +return to; +} /* WRITE -- Write to the directory queue @@ -190,26 +235,56 @@ for( node = ctx->header_node; node != 0; node = node->element_node ) { if (! node->element) continue; - fprintf( filehandle, - ((*node->payload == '\0') ? "\n<%s%s%s/>" : "\n<%s%s%s>%s</%s>"), - node->element, (*node->attribute == '\0' ? "":" "), node->attribute, - node->payload, node->element ); + + if (*node->payload == '\0') { + fprintf( filehandle, "\n<%s%s%s/>", + node->element, (*node->attribute == '\0' ? "":" "), node->attribute ); + continue; + } + + int encoded_length = strlen(node->payload) * 6; + char encoded_payload[encoded_length]; + fprintf( filehandle, "\n<%s%s%s>%s</%s>", + node->element, (*node->attribute == '\0' ? "":" "), node->attribute, + xml_encode(node->payload, encoded_payload, encoded_length), node->element ); } - fprintf( filehandle, "\n<patient>%s</patient>", fil->f_prevhost ); + { + int encoded_length = strlen(fil->f_prevhost) * 6; + char encoded_payload[encoded_length]; + fprintf( filehandle, "\n<patient>%s</patient>", + xml_encode(fil->f_prevhost, encoded_payload, encoded_length) ); + } fprintf( filehandle, "\n<timestamp>%d</timestamp>", (int)timer ); - if (ctx->key) fprintf( filehandle, "\n<key>%s</key>", ctx->key ); + if (ctx->key) { + int encoded_length = strlen(ctx->key) * 6; + char encoded_payload[encoded_length]; + fprintf( filehandle, "\n<key>%s</key>", + xml_encode(ctx->key, encoded_payload, encoded_length) ); + } - fprintf( filehandle, "\n<message facility=\"%d\" priority=\"%d\">%s</message>", - msg->fac, msg->pri, msg->msg ); + { + int encoded_length = strlen(msg->msg) * 6; + char encoded_payload[encoded_length]; + fprintf( filehandle, "\n<message facility=\"%d\" priority=\"%d\">%s</message>", + msg->fac, msg->pri, xml_encode(msg->msg, encoded_payload, encoded_length) ); + } for( node = ctx->footer_node; node != 0; node = node->element_node ) { if (! node->element) continue; - fprintf( filehandle, - ((*node->payload == '\0') ? "\n<%s%s%s/>" : "\n<%s%s%s>%s</%s>"), - node->element, (*node->attribute == '\0' ? "":" "), node->attribute, - node->payload, node->element ); + + if (*node->payload == '\0') { + fprintf( filehandle, "\n<%s%s%s/>", + node->element, (*node->attribute == '\0' ? "":" "), node->attribute ); + continue; + } + + int encoded_length = strlen(node->payload) * 6; + char encoded_payload[encoded_length]; + fprintf( filehandle, "\n<%s%s%s>%s</%s>", + node->element, (*node->attribute == '\0' ? "":" "), node->attribute, + xml_encode(node->payload, encoded_payload, encoded_length), node->element ); } { fprintf( filehandle, "\n</ticket>\n" ); } |
From: <ph...@us...> - 2003-04-01 21:07:30
|
Update of /cvsroot/msyslog/syslog/src/modules In directory sc8-pr-cvs1:/tmp/cvs-serv26338/syslog/src/modules Modified Files: im_udp.c Log Message: strncat used where strncpy should have been used. Index: im_udp.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/modules/im_udp.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -r1.80 -r1.81 --- im_udp.c 22 Feb 2003 03:40:58 -0000 1.80 +++ im_udp.c 1 Apr 2003 21:07:26 -0000 1.81 @@ -230,11 +230,12 @@ ret->im_msg[n1++] = ret->im_msg[n2++]; ret->im_msg[n1] = '\0'; - strncat(ret->im_host, host, + strncpy(ret->im_host, host, sizeof(ret->im_host) - strlen(ret->im_host) - 1); ret->im_host[sizeof (ret->im_host) - 1] = '\0'; } + m_dprintf(MSYSLOG_INFORMATIVE, "im_udp_read: ... leaving.\n"); return (1); } |
From: <ph...@us...> - 2003-04-01 21:07:30
|
Update of /cvsroot/msyslog/syslog In directory sc8-pr-cvs1:/tmp/cvs-serv26338/syslog Modified Files: configure Log Message: strncat used where strncpy should have been used. Index: configure =================================================================== RCS file: /cvsroot/msyslog/syslog/configure,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -r1.92 -r1.93 --- configure 27 Sep 2002 22:28:29 -0000 1.92 +++ configure 1 Apr 2003 21:07:24 -0000 1.93 @@ -1,12 +1,81 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by Autoconf 2.52. +# Generated by GNU Autoconf 2.57. # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +## --------------------- ## [...7813 lines suppressed...] chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open @@ -5939,8 +7818,11 @@ # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null - $SHELL $CONFIG_STATUS || ac_cs_success=false + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. |
From: <al...@us...> - 2003-03-22 15:41:45
|
Update of /cvsroot/msyslog/syslog/src In directory sc8-pr-cvs1:/tmp/cvs-serv13664 Modified Files: syslogd.c Log Message: From OpenBSD's CVS commit by Todd Miller Fix default facility when none is specified (should be LOG_USER, was LOG_UUCP due to a bug); Javier Kohen Index: syslogd.c =================================================================== RCS file: /cvsroot/msyslog/syslog/src/syslogd.c,v retrieving revision 1.235 retrieving revision 1.236 diff -u -d -r1.235 -r1.236 --- syslogd.c 8 Jan 2003 16:02:44 -0000 1.235 +++ syslogd.c 22 Mar 2003 15:41:41 -0000 1.236 @@ -741,9 +741,14 @@ if (pri &~ (LOG_FACMASK | LOG_PRIMASK)) pri = DEFUPRI; #ifndef INSECURE_KERNEL_INPUT - /* don't allow users to log kernel messages */ - if (LOG_FAC(pri) == LOG_KERN && !(flags & IMODULE_FLAG_KERN)) - pri = LOG_MAKEPRI(LOG_USER, LOG_PRI(pri)); + /* + * Don't allow users to log kernel messages. + * NOTE: since LOG_KERN == 0 this will also match + * messages with no facility specified. + */ + + if (LOG_FAC(pri) == LOG_KERN && !(flags & IMODULE_FLAG_KERN)) + pri = LOG_USER | LOG_PRI(pri); #endif q = line; |
From: <al...@us...> - 2003-02-27 21:58:52
|
Update of /cvsroot/msyslog/msyslog-event/src In directory sc8-pr-cvs1:/tmp/cvs-serv11138 Modified Files: Makefile Log Message: proper place for -levent Index: Makefile =================================================================== RCS file: /cvsroot/msyslog/msyslog-event/src/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile 23 Feb 2003 22:19:14 -0000 1.1.1.1 +++ Makefile 27 Feb 2003 21:58:44 -0000 1.2 @@ -27,7 +27,7 @@ $(CC) $(CFLAGS) -c $< -o $@ $(PROG): $(OBJS) - $(CC) $(CFLAGS) $(LIBS) -o $@ $(OBJS) + $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) all: $(PROG) |
From: <al...@us...> - 2003-02-25 21:18:53
|
Update of /cvsroot/msyslog/msyslog-event/src In directory sc8-pr-cvs1:/tmp/cvs-serv5710 Modified Files: engine.c Log Message: signal handler Index: engine.c =================================================================== RCS file: /cvsroot/msyslog/msyslog-event/src/engine.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- engine.c 25 Feb 2003 00:01:29 -0000 1.2 +++ engine.c 25 Feb 2003 21:18:41 -0000 1.3 @@ -225,6 +225,12 @@ return; } +/* handler for signals on libevent */ +void +sighandler(int i, short event, void *blah) +{ + +} /* * d_printf(): |
From: <al...@us...> - 2003-02-25 00:01:36
|
Update of /cvsroot/msyslog/msyslog-event/src In directory sc8-pr-cvs1:/tmp/cvs-serv16904 Modified Files: engine.c modules.c msyslog.h Log Message: change parser not to use multiple modules in blocks simplify it a bit while there some event work too (yeah, multiple changes shouldn't be committed together, d'oh) Index: engine.c =================================================================== RCS file: /cvsroot/msyslog/msyslog-event/src/engine.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- engine.c 23 Feb 2003 22:19:14 -0000 1.1.1.1 +++ engine.c 25 Feb 2003 00:01:29 -0000 1.2 @@ -38,6 +38,7 @@ #include <sys/time.h> #include <event.h> +#include <signal.h> #include <stdarg.h> /* var arguments for d_printf() */ #include <stdio.h> #include <string.h> @@ -50,34 +51,83 @@ */ extern int debug_level; +/* Filter entry */ + +struct m_filter { + struct m_filter *next; + struct p_stack stack; +}; + +/* NonInput module entry */ + +struct m_ninput { + struct m_ninput *next; + M_FUNC *func; + char ctx[MAX_CTX_SIZE]; + int fd; + int flags; +}; + +/* Path entry */ + +struct m_path { + struct m_path *next; + struct m_filter *filters[MAX_FILTERS_PER_RULE]; + int fcount; + struct m_ninput *true[MAX_NONINPUTS_PER_RULE]; + int trues; + struct m_ninput *false[MAX_NONINPUTS_PER_RULE]; + int falses; +}; + + +/* Input module entry */ + +struct m_input { + struct m_input *next; + M_FUNC *func; + struct event ev; + struct m_arg arg; + struct m_path *paths[MAX_PATHS_PER_INPUT]; + int pcount; + char ctx[MAX_CTX_SIZE]; + int flags; +}; + + + /* XXX: remove this later */ int m_unix(struct m_arg *); int m_file(struct m_arg *); int parse_msg(struct m_msg *); int print_msg(struct m_msg *, char *); -int process_config(struct p_option **, struct p_input_block **, - struct p_filter_block **, struct p_noninput_block **, - struct p_path **, FILE *); +int process_config(struct p_option **, struct p_input **, struct p_filter **, + struct p_ninput **, struct p_path **, FILE *); /* functions */ -int init_inputs(struct p_input_block *); -int init_noninputs(struct p_noninput_block *); -int init_filters(struct p_filter_block *); -int close_noninputs(struct p_noninput_block *); -int close_inputs(struct p_input_block *); -int free_parsed(struct p_option *, struct p_input_block *, - struct p_filter_block *, struct p_noninput_block *, struct p_path *); +int init_inputs(struct p_input *, struct m_input *); +int init_ninputs(struct p_ninput *); +int init_filters(struct p_filter *); +int close_ninputs(struct p_ninput *); +int close_inputs(struct p_input *); +int free_filters(struct p_filter *); +int free_parsed(struct p_option *, struct p_input *, struct p_filter *, + struct p_ninput *, struct p_path *); +void sighandler(int, short, void *); +void func_wrap(int, short, void *); int msyslog_engine_func(char *conf) { - struct p_option *options; - struct p_input_block *inputs; - struct p_noninput_block *noninputs; - struct p_filter_block *filters; + struct event sighup_ev; + struct p_option *poptions; + struct p_input *pinputs; + struct p_ninput *pninputs; + struct p_filter *filters; struct p_path *paths; + struct m_input *ins, *im; FILE *cf; /* open config file */ @@ -87,7 +137,7 @@ } /* call parser */ - if (process_config(&options, &inputs, &filters, &noninputs, + if (process_config(&poptions, &pinputs, &filters, &pninputs, &paths, cf) == -1) { d_printf(D_SERIOUS, "Error, parsing config file"); @@ -96,41 +146,58 @@ } /* init input modules */ - if (init_inputs(inputs) == -1) { + ins = NULL; + if (init_inputs(pinputs, ins) == -1) { d_printf(D_SERIOUS, "Error, initializing input modules"); - free_parsed(options, inputs, filters, noninputs, paths); - return (-1); + goto engine_end; } - /* init noninput modules */ - if (init_noninputs(noninputs) == -1) { + /* init ninput modules */ + if (init_ninputs(pninputs) == -1) { - d_printf(D_SERIOUS, "Error, initializing noninput modules"); - close_inputs(inputs); - free_parsed(options, inputs, filters, noninputs, paths); - return (-1); + d_printf(D_SERIOUS, "Error, initializing ninput modules"); + goto engine_end; } /* init filter modules, required for regex compilation */ if (init_filters(filters) == -1) { d_printf(D_SERIOUS, "Error, initializing filters"); - close_noninputs(noninputs); - close_inputs(inputs); - free_parsed(options, inputs, filters, noninputs, paths); + close_ninputs(pninputs); + close_inputs(pinputs); + free_parsed(poptions, pinputs, filters, pninputs, paths); return (-1); } -#warning finish this + if (free_parsed(poptions, pinputs, filters, pninputs, paths)) + d_printf(D_SERIOUS, "Error, freeing parsed strings"); -#warning usar events desde aca + /* initialize event library */ + event_init(); + + /* add event to SIGHUP */ + signal_set(&sighup_ev, SIGHUP, sighandler, NULL); + + /* add event for each input module */ + for (im = ins; im != NULL; im = im->next) + event_set(&im->ev, im->arg.fd, EV_READ, func_wrap, im); +#warning finish this use libevent from here /* close/restart requested: close, log all, and clean up */ -#warning finish this +engine_end: + /* close input modules */ + if (close_inputs(pinputs) == -1) + d_printf(D_SERIOUS, "Error, closing input modules"); - /* XXX: close */ + /* close ninput modules */ + if (close_ninputs(pninputs) == -1) + d_printf(D_SERIOUS, "Error, closing ninput modules"); + + /* free filter modules, required for regex compilation */ + if (free_filters(filters) == -1) + d_printf(D_SERIOUS, "Error, initializing filters"); return (1); } @@ -139,6 +206,25 @@ { printf("%s\n", errmsg); } + +/* Wrapper to call module function from event */ +void +func_wrap(int fd, short event, void *ev_arg) +{ + struct m_input *im; + + im = (struct m_input *) ev_arg; + + /* call module function */ + if (im->func(&im->arg) == -1) { + d_printf(D_SERIOUS, "Error, reading module"); + /* XXX: should we reinit here ?? */ + /* XXX: should we remove this event ?? */ + } + + return; +} + /* * d_printf(): Index: modules.c =================================================================== RCS file: /cvsroot/msyslog/msyslog-event/src/modules.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- modules.c 23 Feb 2003 22:19:17 -0000 1.1.1.1 +++ modules.c 25 Feb 2003 00:01:30 -0000 1.2 @@ -69,43 +69,30 @@ /* functions */ int -init_inputs(struct p_input_block *ib) +init_inputs(struct p_input *ib) { -struct p_input_block { - struct p_input_block *next; - char *name; - struct p_path *paths[MAX_PATHS_PER_INPUT_BLOCK]; - int pcount; - struct p_args modules[MAX_INPUTS_PER_BLOCK]; - int mcount; -}; -struct m_arg { - char ctx[MAX_CTX_SIZE]; - char err_buf[MAX_ERRSIZE]; - int action; - int fd; - union { - struct p_args args; - struct m_msg msg; - } u; -}; + + return (1); +} +int +init_ninputs(struct p_ninput *nb) +{ return (1); } int -init_noninputs(struct p_noninput_block *nb) +init_filters(struct p_filter *fb) { return (1); } - int -init_filters(struct p_filter_block *fb) +free_filters(struct p_filter *fb) { return (1); @@ -113,7 +100,7 @@ int -close_noninputs(struct p_noninput_block *nb) +close_ninputs(struct p_ninput *nb) { return (1); @@ -121,7 +108,7 @@ int -close_inputs(struct p_input_block *ib) +close_inputs(struct p_input *ib) { return (1); @@ -129,8 +116,8 @@ int -free_parsed(struct p_option *o, struct p_input_block *ib, - struct p_filter_block *fb, struct p_noninput_block *nb, +free_parsed(struct p_option *o, struct p_input *ib, + struct p_filter *fb, struct p_ninput *nb, struct p_path *p) { Index: msyslog.h =================================================================== RCS file: /cvsroot/msyslog/msyslog-event/src/msyslog.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- msyslog.h 23 Feb 2003 22:58:50 -0000 1.2 +++ msyslog.h 25 Feb 2003 00:01:30 -0000 1.3 @@ -44,12 +44,9 @@ * keep this as low (but functional) as possible, so have it on stack * without eating too much memory */ -#define MAX_INPUTS_PER_BLOCK 3 -#define MAX_NONINPUTS_PER_BLOCK 3 #define MAX_NONINPUTS_PER_RULE 3 -#define MAX_PATHS_PER_INPUT_BLOCK 3 +#define MAX_PATHS_PER_INPUT 3 #define MAX_FILTERS_PER_RULE 3 -#define MAX_EVALUATION_STACKS 3 /* WTF was this for ? */ #define MAX_IO_LENGTH 2048 /* max size to read/write */ #define MAX_MSG_SIZE 1024 /* max message content */ @@ -104,10 +101,10 @@ * and optional others if FALSE */ -struct p_filter_block { - struct p_filter_block *next; - char *name; +struct p_filter { + struct p_filter *next; struct p_stack stack; + char *name; }; @@ -116,11 +113,10 @@ * */ -struct p_noninput_block { - struct p_noninput_block *next; +struct p_ninput { + struct p_ninput *next; + struct p_args module; char *name; - int mcount; - struct p_args modules[MAX_NONINPUTS_PER_BLOCK]; }; @@ -133,12 +129,12 @@ struct p_path { struct p_path *next; - struct p_filter_block *filters[MAX_FILTERS_PER_RULE]; - int fcount; - struct p_noninput_block *true[MAX_NONINPUTS_PER_RULE]; - int trues; - struct p_noninput_block *false[MAX_NONINPUTS_PER_RULE]; - int falses; + struct p_filter *filters[MAX_FILTERS_PER_RULE]; + int fcount; + struct p_ninput *true[MAX_NONINPUTS_PER_RULE]; + int trues; + struct p_ninput *false[MAX_NONINPUTS_PER_RULE]; + int falses; }; /* @@ -147,13 +143,12 @@ * It points to one or more path wich messages should follow */ -struct p_input_block { - struct p_input_block *next; - char *name; - struct p_path *paths[MAX_PATHS_PER_INPUT_BLOCK]; - int pcount; - struct p_args modules[MAX_INPUTS_PER_BLOCK]; - int mcount; +struct p_input { + struct p_input *next; + struct p_args module; + struct p_path *paths[MAX_PATHS_PER_INPUT]; + char *name; + int pcount; }; |
From: <al...@us...> - 2003-02-25 00:01:34
|
Update of /cvsroot/msyslog/msyslog-event/src/config In directory sc8-pr-cvs1:/tmp/cvs-serv16904/config Modified Files: config.y Log Message: change parser not to use multiple modules in blocks simplify it a bit while there some event work too (yeah, multiple changes shouldn't be committed together, d'oh) Index: config.y =================================================================== RCS file: /cvsroot/msyslog/msyslog-event/src/config/config.y,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- config.y 23 Feb 2003 22:19:23 -0000 1.1.1.1 +++ config.y 25 Feb 2003 00:01:31 -0000 1.2 @@ -31,35 +31,31 @@ #define BUILD_NUM_OP(x,y) ((2 << 24) | ((x & 0xff) << 16) | (y & 0xff)) #define BUILD_STR_OP(x,y) ((3 << 24) | ((x & 0xff) << 16) | (y & 0xff)) -char *name; /* save an option, filter or module block name */ +char *name; /* save an option, filter or module name */ extern char *yytext; extern int lineno; /* Elements are pushed, since there is no need of order here */ struct p_option *Options; -struct p_input_block *Input_Blocks; -struct p_filter_block *Filter_Blocks; -struct p_noninput_block *Noninput_Blocks; +struct p_input *Inputs; +struct p_filter *Filters; +struct p_ninput *Noninputs; struct p_path *Paths; %} %union { char *string; - struct p_args args; + struct p_args args; /* used for matched module */ struct { int filargc; /* filters count */ char *filargv[MAX_ARGVS]; /* filter names */ - int targc; /* true noninputs count */ - char *targv[MAX_ARGVS]; /* true noninputs names */ - int fargc; /* false noninputs count */ - char *fargv[MAX_ARGVS]; /* false noninputs names */ + int targc; /* true ninputs count */ + char *targv[MAX_ARGVS]; /* true ninputs names */ + int fargc; /* false ninputs count */ + char *fargv[MAX_ARGVS]; /* false ninputs names */ } path; - struct { - int mcount; - struct p_args modules[MAX_INPUTS_PER_BLOCK + 1]; - } modules; /* used for matched blocks */ struct p_stack stack; int integer; } @@ -79,9 +75,8 @@ %type <integer> comp strfield numfield %type <integer> priority facility integer_value -%type <path> path_second_part path_noninputs +%type <path> path_second_part path_ninputs %type <args> names -%type <modules> args %type <stack> expression evaluation %left OPOR OPAND @@ -97,9 +92,9 @@ ; line: option - | noninput_block - | input_block - | filter_block + | ninput + | input + | filter | path ; @@ -107,117 +102,67 @@ struct p_option *pob; if ((pob = (struct p_option *) - malloc(sizeof(struct p_option))) == NULL) { + calloc(1, sizeof(struct p_option))) == NULL) { /* do some error reporting */ } - if (Options == NULL) { - pob->next = NULL; - } else { - pob->next = Options; - } + + pob->next = Options; Options = pob; pob->name = $2; - pob->args.argc = $4.argc; - if (sizeof(pob->args.argv) < (($4.argc * sizeof(char *)) - 1)) { - /* do some error reporting */ - /* and free all stuff duped! */ - } - memcpy(pob->args.argv, $4.argv, pob->args.argc * sizeof(char *)); + memcpy(&pob->args, &$4, sizeof(pob->args)); pob->args.argv[pob->args.argc] = NULL; } ; -noninput_block: NONINPUT WORD ':' args { - struct p_noninput_block *nib; +ninput: NONINPUT WORD ':' ARGV { + struct p_ninput *nm; - if ((nib = (struct p_noninput_block *) - malloc(sizeof(struct p_noninput_block))) == NULL) { + if ((nm = (struct p_ninput *) + calloc(1, sizeof(struct p_ninput))) == NULL) { /* some error stuff */ } /* add this block */ - if (Noninput_Blocks == NULL) { - nib->next = NULL; - } else { - nib->next = Noninput_Blocks; - } - Noninput_Blocks = nib; - if (sizeof(nib->modules) < ($4.mcount * sizeof($4.modules[0]))) { - /* do some error reporting */ - /* and free all stuff duped! */ - } - memcpy(nib->modules, $4.modules, $4.mcount - * sizeof($4.modules[0])); - nib->name = $2; - nib->mcount = $4.mcount; + nm->next = Noninputs; + Noninputs = nm; + memcpy(&nm->module, &$4, sizeof(nm->module)); + nm->name = $2; } ; -input_block: INPUT WORD ':' args { - struct p_input_block *ib; +input: INPUT WORD ':' ARGV { + struct p_input *im; - if ((ib = (struct p_input_block *) - malloc(sizeof(struct p_input_block))) == NULL) { + if ((im = (struct p_input *) + calloc(1, sizeof(struct p_input))) == NULL) { /* some error stuff */ } /* add this block */ - if (Input_Blocks == NULL) { - ib->next = NULL; - } else { - ib->next = Input_Blocks; - } - Input_Blocks = ib; - if (sizeof(ib->modules) < ($4.mcount * sizeof($4.modules[0]))) { - /* do some error reporting */ - /* and free all stuff duped! */ - } - memcpy(ib->modules, $4.modules, $4.mcount - * sizeof($4.modules[0])); - ib->name = $2; - ib->mcount = $4.mcount; + im->next = Inputs; + Inputs = im; + memcpy(&im->module, &$4, sizeof(im->module)); + im->name = $2; } ; -args: args ARGV { - if (sizeof($$) < (sizeof($1) + sizeof($$.modules[0]))) { - /* do some error reporting */ - /* and free all stuff duped! */ - } - memcpy(&$$, &$1, sizeof($1)); - memcpy(&$$.modules[$$.mcount++], &$2, sizeof($2)); - } - | ARGV { - $$.mcount = 1; - if (sizeof($$.modules[0]) < sizeof($1)) { - /* do some error reporting */ - /* and free all stuff duped! */ - } - memcpy(&$$.modules[0], &$1, sizeof($1)); - } - ; - -filter_block: FILTER WORD ':' expression { - struct p_filter_block *fb; +filter: FILTER WORD ':' expression { + struct p_filter *fb; - if ((fb = (struct p_filter_block *) - malloc(sizeof(struct p_filter_block))) == NULL) { + if ((fb = (struct p_filter *) + calloc(1, sizeof(struct p_filter))) == NULL) { /* some error stuff */ } /* add this block */ - if (Filter_Blocks == NULL) { - fb->next = NULL; - } else { - fb->next = Filter_Blocks; - } - Filter_Blocks = fb; - fb->name = $2; + fb->next = Filters; + Filters = fb; /* size of stack */ memcpy(&fb->stack, &$4, sizeof(fb->stack)); + fb->name = $2; } ; @@ -393,7 +338,7 @@ | LOCAL7 { $$ = LOG_LOCAL7; } ; -path_noninputs: names ',' names { +path_ninputs: names ',' names { if ((sizeof($$.targv) < ($1.argc * sizeof(char *)) - 1) || (sizeof($$.fargv) < ($3.argc * sizeof(char *)) - 1)) { /* some error stuff */ @@ -414,7 +359,7 @@ } ; -path_second_part: names ':' path_noninputs { +path_second_part: names ':' path_ninputs { $$.filargc = $1.argc; memcpy(&$$.fargv, $3.filargv, sizeof($3.filargv)); $$.targc = $3.targc; @@ -422,7 +367,7 @@ $$.fargc = $3.fargc; memcpy(&$$.fargv, $3.fargv, sizeof($3.fargv)); } - | path_noninputs { + | path_ninputs { $$.targc = $1.targc; memcpy(&$$.targv, $1.targv, sizeof($1.targc)); $$.fargc = $1.fargc; @@ -432,13 +377,13 @@ path: PATH names ':' path_second_part { struct p_path *pb; - struct p_input_block *inp; - struct p_filter_block *filt; - struct p_noninput_block *ninp; + struct p_input *inp; + struct p_filter *filt; + struct p_ninput *ninp; int i; if ((pb = (struct p_path *) - malloc(sizeof(struct p_path))) == NULL) { + calloc(1, sizeof(struct p_path))) == NULL) { /* some error stuff */ } @@ -452,7 +397,7 @@ /* link inputs to this path */ for (i = 0; i < $2.argc; i++) { - for (inp = Input_Blocks; inp && inp->name + for (inp = Inputs; inp && inp->name && strcmp(inp->name, $2.argv[i]) != 0; inp = inp->next) ; @@ -468,7 +413,7 @@ /* link filters from this path */ for (i = 0; i < $4.filargc; i++) { - for (filt = Filter_Blocks; filt && filt->name + for (filt = Filters; filt && filt->name && strcmp(filt->name, $4.fargv[i]) != 0; filt = filt->next) ; @@ -482,9 +427,9 @@ } } - /* link true noninputs from this path */ + /* link true ninputs from this path */ for (i = 0; i < $4.targc; i++) { - for (ninp = Noninput_Blocks; ninp && ninp->name + for (ninp = Noninputs; ninp && ninp->name && strcmp(ninp->name, $4.targv[i]) != 0; ninp = ninp->next) ; @@ -497,9 +442,9 @@ return (-1); } } - /* link false noninputs from this path */ + /* link false ninputs from this path */ for (i = 0; i < $4.targc; i++) { - for (ninp = Noninput_Blocks; ninp && ninp->name + for (ninp = Noninputs; ninp && ninp->name && strcmp(ninp->name, $4.fargv[i]) != 0; ninp = ninp->next) ; @@ -533,14 +478,13 @@ int yyparse(void); int -process_config(struct p_option **pOptions, struct p_input_block **pInput_Blocks, - struct p_filter_block **pFilter_Blocks, - struct p_noninput_block **pNoninput_Blocks, struct p_path **pPaths, - FILE *Config) +process_config(struct p_option **pOptions, struct p_input **pInputs, + struct p_filter **pFilters, struct p_ninput **pNoninputs, + struct p_path **pPaths, FILE *Config) { - if (Config == NULL || pOptions == NULL || pInput_Blocks == NULL - || pFilter_Blocks == NULL || pNoninput_Blocks == NULL + if (Config == NULL || pOptions == NULL || pInputs == NULL + || pFilters == NULL || pNoninputs == NULL || pPaths == NULL) return (-1); @@ -552,9 +496,9 @@ } while (parse_error[0] == '\0' && !feof(Config)); *pOptions = Options; - *pInput_Blocks = Input_Blocks; - *pFilter_Blocks = Filter_Blocks; - *pNoninput_Blocks = Noninput_Blocks; + *pInputs = Inputs; + *pFilters = Filters; + *pNoninputs = Noninputs; *pPaths = Paths; return (1); |
From: <al...@us...> - 2003-02-23 23:01:49
|
Update of /cvsroot/msyslog/msyslog-event/src In directory sc8-pr-cvs1:/tmp/cvs-serv7520 Removed Files: lex.yy.c y.tab.c y.tab.h Log Message: remove generated parser files --- lex.yy.c DELETED --- --- y.tab.c DELETED --- --- y.tab.h DELETED --- |