diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-24 07:35:13 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-24 07:35:13 +0000 |
commit | cb2fc5f2d664ce48b9e3e8fd6c06e3aa3a9d9f66 (patch) | |
tree | 3b750bb2624ae9a90c96e2bc15d9a687df0764b3 | |
parent | d9653ad08ffd2e8578aac00777cd610fce1f05c1 (diff) | |
download | rsyslog-cb2fc5f2d664ce48b9e3e8fd6c06e3aa3a9d9f66.tar.gz rsyslog-cb2fc5f2d664ce48b9e3e8fd6c06e3aa3a9d9f66.tar.xz rsyslog-cb2fc5f2d664ce48b9e3e8fd6c06e3aa3a9d9f66.zip |
fixed wrong credits - last patch was by mildew -- sorry for that ;)
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | omfile.c | 4 | ||||
-rw-r--r-- | omfile.h | 1 | ||||
-rw-r--r-- | omfwd.c | 78 | ||||
-rw-r--r-- | omfwd.h | 1 | ||||
-rw-r--r-- | ommysql.c | 78 | ||||
-rw-r--r-- | ommysql.h | 2 | ||||
-rw-r--r-- | omshell.c | 8 | ||||
-rw-r--r-- | omshell.h | 1 | ||||
-rw-r--r-- | omusrmsg.c | 38 | ||||
-rw-r--r-- | syslogd.c | 68 |
11 files changed, 146 insertions, 135 deletions
@@ -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 @@ -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; } @@ -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 */ /* @@ -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: @@ -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 */ /* @@ -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: @@ -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 */ @@ -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; } @@ -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 */ /* @@ -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 @@ -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; } |