From cb2fc5f2d664ce48b9e3e8fd6c06e3aa3a9d9f66 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 24 Jul 2007 07:35:13 +0000 Subject: fixed wrong credits - last patch was by mildew -- sorry for that ;) --- ChangeLog | 2 +- omfile.c | 4 +++- omfile.h | 1 - omfwd.c | 78 ++++++++++++++++++++++++++++++++------------------------------ omfwd.h | 1 - ommysql.c | 78 ++++++++++++++++++++++++++++++++------------------------------ ommysql.h | 2 -- omshell.c | 8 ++++--- omshell.h | 1 - omusrmsg.c | 38 +++++++++++++++--------------- syslogd.c | 68 +++++++++++++++++++++++++++++------------------------- 11 files changed, 146 insertions(+), 135 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b719d44..6a4abc3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,7 @@ Version 1.17.3 (rgerhards), 2007-07-2? at all. If it cant, it complains and terminates thanks to Michel Samia for providing the patch! - fixed a small memory leak when HUPing syslogd. The allowed sender - list now gets freed. thanks varmojfekoj to for the patch. + list now gets freed. thanks mildew to for the patch. --------------------------------------------------------------------------- Version 1.17.2 (rgerhards), 2007-07-23 - made the port part of the -r option optional. Needed for backward diff --git a/omfile.c b/omfile.c index 28085d34..e035545a 100644 --- a/omfile.c +++ b/omfile.c @@ -525,7 +525,7 @@ rsRetVal doActionFile(selector_t *f) * applies to this module and, if so, processed it. If not, it * is left untouched. The driver will then call another module */ -rsRetVal parseSelectorActFile(uchar **pp, selector_t *f) +static rsRetVal parseSelectorAct(uchar **pp, selector_t *f) { uchar *p; int syncfile; @@ -659,6 +659,8 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)()) *pEtryPoint = NULL; if(!strcmp((char*) name, "doAction")) { *pEtryPoint = doActionFile; + } else if(!strcmp((char*) name, "parseSelectorAct")) { + *pEtryPoint = parseSelectorAct; } else if(!strcmp((char*) name, "freeInstance")) { *pEtryPoint = freeInstanceFile; } diff --git a/omfile.h b/omfile.h index e2b77706..b60b8a9d 100644 --- a/omfile.h +++ b/omfile.h @@ -29,7 +29,6 @@ rsRetVal doActionFile(selector_t *f); rsRetVal freeInstanceFile(selector_t *f); rsRetVal modInitFile(int iIFVersRequested, int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)()); -rsRetVal parseSelectorActFile(uchar **pp, selector_t *f); #endif /* #ifndef OMFILE_H_INCLUDED */ /* diff --git a/omfwd.c b/omfwd.c index 67aeb792..69b51702 100644 --- a/omfwd.c +++ b/omfwd.c @@ -241,49 +241,12 @@ int doActionFwd(selector_t *f) return 0; } -/* query an entry point - */ -static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)()) -{ - if((name == NULL) || (pEtryPoint == NULL)) - return RS_RET_PARAM_ERROR; - - *pEtryPoint = NULL; - if(!strcmp((char*) name, "doAction")) { - *pEtryPoint = doActionFwd; - } /*else if(!strcmp((char*) name, "freeInstance")) { - *pEtryPoint = freeInstanceFile; - }*/ - - return(*pEtryPoint == NULL) ? RS_RET_NOT_FOUND : RS_RET_OK; -} - -/* initialize the module - * - * Later, much more must be done. So far, we only return a pointer - * to the queryEtryPt() function - * TODO: do interface version checking & handshaking - * iIfVersRequeted is the version of the interface specification that the - * caller would like to see being used. ipIFVersProvided is what we - * decide to provide. - */ -rsRetVal modInitFwd(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)()) -{ - if((pQueryEtryPt == NULL) || (ipIFVersProvided == NULL)) - return RS_RET_PARAM_ERROR; - - *ipIFVersProvided = 1; /* so far, we only support the initial definition */ - - *pQueryEtryPt = queryEtryPt; - return RS_RET_OK; -} - /* try to process a selector action line. Checks if the action * applies to this module and, if so, processed it. If not, it * is left untouched. The driver will then call another module */ -rsRetVal parseSelectorActFwd(uchar **pp, selector_t *f) +static rsRetVal parseSelectorAct(uchar **pp, selector_t *f) { uchar *p, *q; int i; @@ -471,6 +434,45 @@ rsRetVal parseSelectorActFwd(uchar **pp, selector_t *f) return iRet; } +/* query an entry point + */ +static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)()) +{ + if((name == NULL) || (pEtryPoint == NULL)) + return RS_RET_PARAM_ERROR; + + *pEtryPoint = NULL; + if(!strcmp((char*) name, "doAction")) { + *pEtryPoint = doActionFwd; + } else if(!strcmp((char*) name, "parseSelectorAct")) { + *pEtryPoint = parseSelectorAct; + } /*else if(!strcmp((char*) name, "freeInstance")) { + *pEtryPoint = freeInstanceFile; + }*/ + + return(*pEtryPoint == NULL) ? RS_RET_NOT_FOUND : RS_RET_OK; +} + +/* initialize the module + * + * Later, much more must be done. So far, we only return a pointer + * to the queryEtryPt() function + * TODO: do interface version checking & handshaking + * iIfVersRequeted is the version of the interface specification that the + * caller would like to see being used. ipIFVersProvided is what we + * decide to provide. + */ +rsRetVal modInitFwd(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)()) +{ + if((pQueryEtryPt == NULL) || (ipIFVersProvided == NULL)) + return RS_RET_PARAM_ERROR; + + *ipIFVersProvided = 1; /* so far, we only support the initial definition */ + + *pQueryEtryPt = queryEtryPt; + return RS_RET_OK; +} + #endif /* #ifdef SYSLOG_INET */ /* * vi:set ai: diff --git a/omfwd.h b/omfwd.h index b65c7637..391c73c2 100644 --- a/omfwd.h +++ b/omfwd.h @@ -27,7 +27,6 @@ /* prototypes */ int doActionFwd(selector_t *f); rsRetVal modInitFwd(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)()); -rsRetVal parseSelectorActFwd(uchar **pp, selector_t *f); #endif /* #ifndef OMFWD_H_INCLUDED */ /* diff --git a/ommysql.c b/ommysql.c index fc7075f1..1c5537e7 100644 --- a/ommysql.c +++ b/ommysql.c @@ -269,49 +269,12 @@ int doActionMySQL(selector_t *f) return 0; } -/* query an entry point - */ -static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)()) -{ - if((name == NULL) || (pEtryPoint == NULL)) - return RS_RET_PARAM_ERROR; - - *pEtryPoint = NULL; - if(!strcmp((char*) name, "doAction")) { - *pEtryPoint = doActionMySQL; - } /*else if(!strcmp((char*) name, "freeInstance")) { - *pEtryPoint = freeInstanceFile; - }*/ - - return(*pEtryPoint == NULL) ? RS_RET_NOT_FOUND : RS_RET_OK; -} - -/* initialize the module - * - * Later, much more must be done. So far, we only return a pointer - * to the queryEtryPt() function - * TODO: do interface version checking & handshaking - * iIfVersRequeted is the version of the interface specification that the - * caller would like to see being used. ipIFVersProvided is what we - * decide to provide. - */ -rsRetVal modInitMySQL(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)()) -{ - if((pQueryEtryPt == NULL) || (ipIFVersProvided == NULL)) - return RS_RET_PARAM_ERROR; - - *ipIFVersProvided = 1; /* so far, we only support the initial definition */ - - *pQueryEtryPt = queryEtryPt; - return RS_RET_OK; -} - /* try to process a selector action line. Checks if the action * applies to this module and, if so, processed it. If not, it * is left untouched. The driver will then call another module */ -rsRetVal parseSelectorActMySQL(uchar **pp, selector_t *f) +static rsRetVal parseSelectorAct(uchar **pp, selector_t *f) { uchar *p; rsRetVal iRet = RS_RET_CONFLINE_PROCESSED; @@ -417,6 +380,45 @@ rsRetVal parseSelectorActMySQL(uchar **pp, selector_t *f) return iRet; } +/* query an entry point + */ +static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)()) +{ + if((name == NULL) || (pEtryPoint == NULL)) + return RS_RET_PARAM_ERROR; + + *pEtryPoint = NULL; + if(!strcmp((char*) name, "doAction")) { + *pEtryPoint = doActionMySQL; + } else if(!strcmp((char*) name, "parseSelectorAct")) { + *pEtryPoint = parseSelectorAct; + } /*else if(!strcmp((char*) name, "freeInstance")) { + *pEtryPoint = freeInstanceFile; + }*/ + + return(*pEtryPoint == NULL) ? RS_RET_NOT_FOUND : RS_RET_OK; +} + +/* initialize the module + * + * Later, much more must be done. So far, we only return a pointer + * to the queryEtryPt() function + * TODO: do interface version checking & handshaking + * iIfVersRequeted is the version of the interface specification that the + * caller would like to see being used. ipIFVersProvided is what we + * decide to provide. + */ +rsRetVal modInitMySQL(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)()) +{ + if((pQueryEtryPt == NULL) || (ipIFVersProvided == NULL)) + return RS_RET_PARAM_ERROR; + + *ipIFVersProvided = 1; /* so far, we only support the initial definition */ + + *pQueryEtryPt = queryEtryPt; + return RS_RET_OK; +} + #endif /* #ifdef WITH_DB */ /* * vi:set ai: diff --git a/ommysql.h b/ommysql.h index 9ecb1333..3b7015ea 100644 --- a/ommysql.h +++ b/ommysql.h @@ -35,8 +35,6 @@ void closeMySQL(register selector_t *f); void reInitMySQL(register selector_t *f); int checkDBErrorState(register selector_t *f); rsRetVal modInitMySQL(int iIFVersRequested, int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)()); -rsRetVal parseSelectorActMySQL(uchar **pp, selector_t *f); - int doActionMySQL(selector_t *f); #endif /* #ifdef WITH_DB */ diff --git a/omshell.c b/omshell.c index 9ea80a0c..2056f521 100644 --- a/omshell.c +++ b/omshell.c @@ -66,7 +66,7 @@ int doActionShell(selector_t *f) * applies to this module and, if so, processed it. If not, it * is left untouched. The driver will then call another module */ -rsRetVal parseSelectorActShell(uchar **pp, selector_t *f) +static rsRetVal parseSelectorAct(uchar **pp, selector_t *f) { uchar *p; rsRetVal iRet = RS_RET_CONFLINE_PROCESSED; @@ -106,9 +106,11 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)()) *pEtryPoint = NULL; if(!strcmp((char*) name, "doAction")) { *pEtryPoint = doActionShell; + } else if(!strcmp((char*) name, "parseSelectorAct")) { + *pEtryPoint = parseSelectorAct; } /*else if(!strcmp((char*) name, "freeInstance")) { - *pEtryPoint = freeInstanceFile; - }*/ + *pEtryPoint = freeInstanceFile; + } */ return(*pEtryPoint == NULL) ? RS_RET_NOT_FOUND : RS_RET_OK; } diff --git a/omshell.h b/omshell.h index 7e3937b3..fa146eb8 100644 --- a/omshell.h +++ b/omshell.h @@ -27,7 +27,6 @@ /* prototypes */ int doActionShell(selector_t *f); rsRetVal modInitShell(int iIFVersRequested, int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)()); -rsRetVal parseSelectorActShell(uchar **pp, selector_t *f); #endif /* #ifndef ACTSHELL_H_INCLUDED */ /* diff --git a/omusrmsg.c b/omusrmsg.c index 6d400655..cdb3981c 100644 --- a/omusrmsg.c +++ b/omusrmsg.c @@ -214,28 +214,11 @@ static int doAction(selector_t *f) return 0; } -/* query an entry point - */ -static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)()) -{ - if((name == NULL) || (pEtryPoint == NULL)) - return RS_RET_PARAM_ERROR; - - *pEtryPoint = NULL; - if(!strcmp((char*) name, "doAction")) { - *pEtryPoint = doAction; - } /*else if(!strcmp((char*) name, "freeInstance")) { - *pEtryPoint = freeInstanceFile; - }*/ - - return(*pEtryPoint == NULL) ? RS_RET_NOT_FOUND : RS_RET_OK; -} - /* try to process a selector action line. Checks if the action * applies to this module and, if so, processed it. If not, it * is left untouched. The driver will then call another module */ -rsRetVal parseSelectorActUsrMsg(uchar **pp, selector_t *f) +static rsRetVal parseSelectorAct(uchar **pp, selector_t *f) { uchar *p, *q; int i; @@ -320,6 +303,25 @@ rsRetVal parseSelectorActUsrMsg(uchar **pp, selector_t *f) return RS_RET_CONFLINE_PROCESSED; } +/* query an entry point + */ +static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)()) +{ + if((name == NULL) || (pEtryPoint == NULL)) + return RS_RET_PARAM_ERROR; + + *pEtryPoint = NULL; + if(!strcmp((char*) name, "doAction")) { + *pEtryPoint = doAction; + } else if(!strcmp((char*) name, "parseSelectorAct")) { + *pEtryPoint = parseSelectorAct; + } /*else if(!strcmp((char*) name, "freeInstance")) { + *pEtryPoint = freeInstanceFile; + }*/ + + return(*pEtryPoint == NULL) ? RS_RET_NOT_FOUND : RS_RET_OK; +} + /* initialize the module * * Later, much more must be done. So far, we only return a pointer diff --git a/syslogd.c b/syslogd.c index 537df108..3c549d7a 100644 --- a/syslogd.c +++ b/syslogd.c @@ -5035,8 +5035,8 @@ static rsRetVal cflineProcessTagSelector(uchar **pline) static rsRetVal cfline(char *line, register selector_t *f) { uchar *p; - int syncfile; rsRetVal iRet; + modInfo_t pMod; dprintf("cfline(%s)", line); @@ -5082,40 +5082,46 @@ static rsRetVal cfline(char *line, register selector_t *f) return(iRet); } - if (*p == '-') { - syncfile = 0; - p++; - } else - syncfile = 1; - dprintf("leading char in action: %c\n", *p); - switch (*p) - { - case '@': - parseSelectorActFwd(&p, f); - break; - case '$': - case '?': - case '|': - case '/': - parseSelectorActFile(&p, f); - break; - case '*': - parseSelectorActUsrMsg(&p, f); - break; - case '~': /* rgerhards 2005-09-09: added support for discard */ + + if(*p == '~') { + /* for the time being, we must handle discard in a special way */ dprintf ("discard\n"); f->f_type = F_DISCARD; - break; - case '>': - parseSelectorActMySQL(&p, f); - break; - case '^': /* bkalkbrenner 2005-09-20: execute shell command */ - parseSelectorActShell(&p, f); - break; - default: - parseSelectorActUsrMsg(&p, f); + } else { + /* loop through all modules and see if one picks up the line */ + pMod = modGetNxt(NULL); + while(pMod != NULL) { + pMod = modGetNxt(pMod); + } +#if 0 + switch (*p) + { + case '@': + parseSelectorActFwd(&p, f); + break; + case '$': + case '?': + case '|': + case '/': + parseSelectorActFile(&p, f); + break; + case '*': + parseSelectorActUsrMsg(&p, f); + break; + case '>': + parseSelectorActMySQL(&p, f); + break; + case '^': /* bkalkbrenner 2005-09-20: execute shell command */ + parseSelectorActShell(&p, f); + break; + default: + parseSelectorActUsrMsg(&p, f); + break; +#endif + } } + return RS_RET_OK; } -- cgit