summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module-template.h12
-rw-r--r--omdiscard.c8
-rw-r--r--omfile.c8
-rw-r--r--omfwd.c8
-rw-r--r--ommysql.c8
-rw-r--r--omshell.c7
-rw-r--r--omusrmsg.c28
-rw-r--r--syslogd-types.h2
-rw-r--r--syslogd.c2
9 files changed, 29 insertions, 54 deletions
diff --git a/module-template.h b/module-template.h
index 200a48c0..55b8f821 100644
--- a/module-template.h
+++ b/module-template.h
@@ -89,7 +89,7 @@ static rsRetVal isCompatibleWithFeature(syslogFeature __attribute__((unused)) eF
/* doAction()
*/
#define BEGINdoAction \
-static rsRetVal doAction(selector_t *f)\
+static rsRetVal doAction(selector_t *f, instanceData __attribute__((unused)) *pData)\
{\
rsRetVal iRet = RS_RET_OK;
@@ -175,14 +175,20 @@ static rsRetVal getWriteFDForSelect(selector_t *f, void *pModData, short *fd)\
static rsRetVal parseSelectorAct(uchar **pp, selector_t *f, void **ppModData)\
{\
rsRetVal iRet = RS_RET_OK;\
- instanceData *pModData = NULL;
+ uchar *p;\
+ instanceData *pData = NULL;
#define CODESTARTparseSelectorAct \
assert(pp != NULL);\
assert(ppModData != NULL);\
- assert(f != NULL);
+ assert(f != NULL);\
+ p = *pp;
#define ENDparseSelectorAct \
+ if(iRet == RS_RET_OK) {\
+ *ppModData = pData;\
+ *pp = p;\
+ }\
return iRet;\
}
diff --git a/omdiscard.c b/omdiscard.c
index 0dbdc6d5..52f1b938 100644
--- a/omdiscard.c
+++ b/omdiscard.c
@@ -75,9 +75,8 @@ ENDfreeInstance
BEGINparseSelectorAct
- uchar *p;
CODESTARTparseSelectorAct
- pModData = NULL; /* this action does not have any instance data */
+ pData = NULL; /* this action does not have any instance data */
p = *pp;
if(*p == '~') {
@@ -87,11 +86,6 @@ CODESTARTparseSelectorAct
} else {
iRet = RS_RET_CONFLINE_UNPROCESSED;
}
-
- if(iRet == RS_RET_OK) {
- *ppModData = pModData;
- *pp = p;
- }
ENDparseSelectorAct
diff --git a/omfile.c b/omfile.c
index ebd91fa1..a2e4dcf6 100644
--- a/omfile.c
+++ b/omfile.c
@@ -568,7 +568,6 @@ ENDdoAction
BEGINparseSelectorAct
- uchar *p;
int syncfile;
CODESTARTparseSelectorAct
p = *pp;
@@ -585,7 +584,7 @@ CODESTARTparseSelectorAct
* the code further changes. -- rgerhards, 2007-07-25
*/
if(*p == '$' || *p == '?' || *p == '|' || *p == '/') {
- if((iRet = createInstance(&pModData)) != RS_RET_OK)
+ if((iRet = createInstance(&pData)) != RS_RET_OK)
return iRet;
}
@@ -683,11 +682,6 @@ CODESTARTparseSelectorAct
iRet = RS_RET_CONFLINE_UNPROCESSED;
break;
}
-
- if(iRet == RS_RET_OK) {
- *ppModData = (void*) pModData;
- *pp = p;
- }
ENDparseSelectorAct
diff --git a/omfwd.c b/omfwd.c
index 81aa5424..4e317f31 100644
--- a/omfwd.c
+++ b/omfwd.c
@@ -670,7 +670,7 @@ ENDdoAction
BEGINparseSelectorAct
- uchar *p, *q;
+ uchar *q;
int i;
int error;
int bErr;
@@ -680,7 +680,7 @@ CODESTARTparseSelectorAct
p = *pp;
if(*p == '@') {
- if((iRet = createInstance(&pModData)) != RS_RET_OK)
+ if((iRet = createInstance(&pData)) != RS_RET_OK)
return iRet;
++p; /* eat '@' */
if(*p == '@') { /* indicator for TCP! */
@@ -838,10 +838,6 @@ CODESTARTparseSelectorAct
iRet = RS_RET_CONFLINE_UNPROCESSED;
}
- if(iRet == RS_RET_OK) {
- *ppModData = pModData;
- *pp = p;
- }
/* TODO: do we need to call freeInstance if we failed - this is a general question for
* all output modules. I'll address it lates as the interface evolves. rgerhards, 2007-07-25
*/
diff --git a/ommysql.c b/ommysql.c
index e0e1f6da..68657755 100644
--- a/ommysql.c
+++ b/ommysql.c
@@ -317,7 +317,6 @@ ENDdoAction
BEGINparseSelectorAct
- uchar *p;
int iMySQLPropErr = 0;
char szTemplateName[128];
CODESTARTparseSelectorAct
@@ -327,7 +326,7 @@ CODESTARTparseSelectorAct
* the code further changes. -- rgerhards, 2007-07-25
*/
if(*p == '>') {
- if((iRet = createInstance(&pModData)) != RS_RET_OK)
+ if((iRet = createInstance(&pData)) != RS_RET_OK)
return iRet;
}
@@ -414,11 +413,6 @@ CODESTARTparseSelectorAct
iRet = RS_RET_CONFLINE_UNPROCESSED;
break;
}
-
- if(iRet == RS_RET_OK) {
- *ppModData = pModData;
- *pp = p;
- }
ENDparseSelectorAct
diff --git a/omshell.c b/omshell.c
index d341126c..a09a72bb 100644
--- a/omshell.c
+++ b/omshell.c
@@ -89,14 +89,13 @@ ENDdoAction
BEGINparseSelectorAct
- uchar *p;
CODESTARTparseSelectorAct
p = *pp;
/* yes, the if below is redundant, but I need it now. Will go away as
* the code further changes. -- rgerhards, 2007-07-25
*/
if(*p == '^') {
- if((iRet = createInstance(&pModData)) != RS_RET_OK)
+ if((iRet = createInstance(&pData)) != RS_RET_OK)
return iRet;
}
@@ -116,10 +115,6 @@ CODESTARTparseSelectorAct
break;
}
- if(iRet == RS_RET_OK) {
- *ppModData = pModData;
- *pp = p;
- }
ENDparseSelectorAct
diff --git a/omusrmsg.c b/omusrmsg.c
index 0b8eccc4..384dd9b5 100644
--- a/omusrmsg.c
+++ b/omusrmsg.c
@@ -58,6 +58,7 @@
/* internal structures
*/
typedef struct _instanceData {
+ char uname[MAXUNAMES][UNAMESZ+1];
} instanceData;
@@ -82,8 +83,8 @@ ENDfreeInstance
BEGINdbgPrintInstInfo
register int i;
CODESTARTdbgPrintInstInfo
- for (i = 0; i < MAXUNAMES && *f->f_un.f_uname[i]; i++)
- printf("%s, ", f->f_un.f_uname[i]);
+ for (i = 0; i < MAXUNAMES && *pData->uname[i]; i++)
+ printf("%s, ", pData->uname[i]);
ENDdbgPrintInstInfo
@@ -140,7 +141,7 @@ void endutent(void)
* Adjust the size of a variable to prevent a buffer overflow
* should _PATH_DEV ever contain something different than "/dev/".
*/
-static void wallmsg(selector_t *f)
+static void wallmsg(selector_t *f, instanceData *pData)
{
char p[sizeof(_PATH_DEV) + UNAMESZ];
@@ -195,11 +196,11 @@ static void wallmsg(selector_t *f)
/* should we send the message to this user? */
if (f->f_type == F_USERS) {
for (i = 0; i < MAXUNAMES; i++) {
- if (!f->f_un.f_uname[i][0]) {
+ if (!pData->uname[i][0]) {
i = MAXUNAMES;
break;
}
- if (strncmp(f->f_un.f_uname[i],
+ if (strncmp(pData->uname[i],
ut.ut_name, UNAMESZ) == 0)
break;
}
@@ -241,12 +242,12 @@ BEGINdoAction
CODESTARTdoAction
dprintf("\n");
/* TODO: change wallmsg so that it returns iRet */
- wallmsg(f);
+ wallmsg(f, pData);
ENDdoAction
BEGINparseSelectorAct
- uchar *p, *q;
+ uchar *q;
int i;
char szTemplateName[128];
CODESTARTparseSelectorAct
@@ -255,8 +256,7 @@ CODESTARTparseSelectorAct
if(**pp != '*')
return RS_RET_CONFLINE_UNPROCESSED;
#endif
- p = *pp;
- if((iRet = createInstance(&pModData)) != RS_RET_OK)
+ if((iRet = createInstance(&pData)) != RS_RET_OK)
return iRet;
@@ -286,11 +286,11 @@ CODESTARTparseSelectorAct
for (i = 0; i < MAXUNAMES && *p && *p != ';'; i++) {
for (q = p; *q && *q != ',' && *q != ';'; )
q++;
- (void) strncpy((char*) f->f_un.f_uname[i], (char*) p, UNAMESZ);
+ (void) strncpy((char*) pData->uname[i], (char*) p, UNAMESZ);
if ((q - p) > UNAMESZ)
- f->f_un.f_uname[i][UNAMESZ] = '\0';
+ pData->uname[i][UNAMESZ] = '\0';
else
- f->f_un.f_uname[i][q - p] = '\0';
+ pData->uname[i][q - p] = '\0';
while (*q == ',' || *q == ' ')
q++;
p = q;
@@ -315,10 +315,6 @@ CODESTARTparseSelectorAct
*/
}
- if(iRet == RS_RET_OK) {
- *ppModData = pModData;
- *pp = p;
- }
ENDparseSelectorAct
diff --git a/syslogd-types.h b/syslogd-types.h
index a4c70ca0..d80741fe 100644
--- a/syslogd-types.h
+++ b/syslogd-types.h
@@ -174,7 +174,7 @@ struct filed {
} f_filterData;
#if 1
union {
- char f_uname[MAXUNAMES][UNAMESZ+1];
+ //char f_uname[MAXUNAMES][UNAMESZ+1];
#ifdef WITH_DB
struct {
MYSQL *f_hmysql; /* handle to MySQL */
diff --git a/syslogd.c b/syslogd.c
index d9d04bb2..dadb2c3d 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -3258,7 +3258,7 @@ rsRetVal fprintlog(register selector_t *f)
/* When we reach this point, we have a valid, non-disabled action.
* So let's execute it. -- rgerhards, 2007-07-24
*/
- iRet = f->pMod->mod.om.doAction(f); /* call configured action */
+ iRet = f->pMod->mod.om.doAction(f, f->pModData); /* call configured action */
if(iRet == RS_RET_DISABLE_ACTION)
f->bEnabled = 0; /* that's it... */