summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-24 06:25:48 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-24 06:25:48 +0000
commitd9653ad08ffd2e8578aac00777cd610fce1f05c1 (patch)
treece968e2fcd68b8c19dfa9fee127ea9c4f9b53ff1
parentd06dafb6768e2bbb4128aa4370fc3dc53fc01056 (diff)
downloadrsyslog-d9653ad08ffd2e8578aac00777cd610fce1f05c1.tar.gz
rsyslog-d9653ad08ffd2e8578aac00777cd610fce1f05c1.tar.xz
rsyslog-d9653ad08ffd2e8578aac00777cd610fce1f05c1.zip
moved selector action config parsing for shell action to omshell
-rw-r--r--omshell.c35
-rw-r--r--omshell.h1
-rw-r--r--syslogd.c14
3 files changed, 37 insertions, 13 deletions
diff --git a/omshell.c b/omshell.c
index 05d61a9e..9ea80a0c 100644
--- a/omshell.c
+++ b/omshell.c
@@ -61,6 +61,41 @@ int doActionShell(selector_t *f)
return 0;
}
+
+/* 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 parseSelectorActShell(uchar **pp, selector_t *f)
+{
+ uchar *p;
+ rsRetVal iRet = RS_RET_CONFLINE_PROCESSED;
+
+ assert(pp != NULL);
+ assert(f != NULL);
+
+ p = *pp;
+
+ switch (*p)
+ {
+ case '^': /* bkalkbrenner 2005-09-20: execute shell command */
+ dprintf("exec\n");
+ ++p;
+ cflineParseFileName(f, p);
+ if (f->f_type == F_FILE) {
+ f->f_type = F_SHELL;
+ f->doAction = doActionShell;
+ }
+ default:
+ iRet = RS_RET_CONFLINE_UNPROCESSED;
+ break;
+ }
+
+ if(iRet == RS_RET_CONFLINE_PROCESSED)
+ *pp = p;
+ return iRet;
+}
+
/* query an entry point
*/
static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())
diff --git a/omshell.h b/omshell.h
index fa146eb8..7e3937b3 100644
--- a/omshell.h
+++ b/omshell.h
@@ -27,6 +27,7 @@
/* 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/syslogd.c b/syslogd.c
index c2224561..537df108 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -5094,37 +5094,25 @@ static rsRetVal cfline(char *line, register selector_t *f)
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 */
dprintf ("discard\n");
f->f_type = F_DISCARD;
break;
-
case '>':
parseSelectorActMySQL(&p, f);
break;
-
case '^': /* bkalkbrenner 2005-09-20: execute shell command */
- dprintf("exec\n");
- ++p;
- cflineParseFileName(f, p);
- if (f->f_type == F_FILE) {
- f->f_type = F_SHELL;
- f->doAction = doActionShell;
- }
+ parseSelectorActShell(&p, f);
break;
-
default:
parseSelectorActUsrMsg(&p, f);
}