summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-07-15 16:11:05 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-07-15 16:11:05 +0200
commit188e4f39fd3c267159c32f750f1da0bc74db910e (patch)
treef19a40ae560d8e80acf6965f235dca0fcda05798 /plugins
parent19864adc4799ce57204fdabb7049e8ec856ed452 (diff)
parent38cdfcfbe1c1ed6aa4a22623afc43d199bc5f7a8 (diff)
downloadrsyslog-188e4f39fd3c267159c32f750f1da0bc74db910e.tar.gz
rsyslog-188e4f39fd3c267159c32f750f1da0bc74db910e.tar.xz
rsyslog-188e4f39fd3c267159c32f750f1da0bc74db910e.zip
Merge branch 'master' into beta
Diffstat (limited to 'plugins')
-rw-r--r--plugins/im3195/Makefile.am8
-rw-r--r--plugins/im3195/im3195.c167
-rw-r--r--plugins/imfile/Makefile.am2
-rw-r--r--plugins/imfile/imfile.c28
-rw-r--r--plugins/imgssapi/.cvsignore6
-rw-r--r--plugins/imgssapi/Makefile.am2
-rw-r--r--plugins/imgssapi/imgssapi.c78
-rw-r--r--plugins/imklog/.cvsignore6
-rw-r--r--plugins/imklog/Makefile.am2
-rw-r--r--plugins/imklog/imklog.c12
-rw-r--r--plugins/imklog/imklog.h2
-rw-r--r--plugins/imklog/linux.c9
-rw-r--r--plugins/immark/.cvsignore6
-rw-r--r--plugins/immark/Makefile.am2
-rw-r--r--plugins/immark/immark.c5
-rw-r--r--plugins/imrelp/.cvsignore6
-rw-r--r--plugins/imrelp/Makefile.am2
-rw-r--r--plugins/imrelp/imrelp.c6
-rw-r--r--plugins/imtcp/.cvsignore6
-rw-r--r--plugins/imtcp/Makefile.am2
-rw-r--r--plugins/imtcp/imtcp.c83
-rw-r--r--plugins/imtemplate/Makefile.am2
-rw-r--r--plugins/imudp/.cvsignore6
-rw-r--r--plugins/imudp/Makefile.am2
-rw-r--r--plugins/imudp/imudp.c17
-rw-r--r--plugins/imuxsock/.cvsignore6
-rw-r--r--plugins/imuxsock/Makefile.am2
-rw-r--r--plugins/imuxsock/imuxsock.c25
-rw-r--r--plugins/omgssapi/.cvsignore6
-rw-r--r--plugins/omgssapi/Makefile.am2
-rw-r--r--plugins/omgssapi/omgssapi.c62
-rw-r--r--plugins/omlibdbi/.cvsignore6
-rw-r--r--plugins/omlibdbi/Makefile.am2
-rw-r--r--plugins/omlibdbi/omlibdbi.c14
-rw-r--r--plugins/ommail/Makefile.am2
-rw-r--r--plugins/ommail/ommail.c12
-rw-r--r--plugins/ommysql/.cvsignore6
-rw-r--r--plugins/ommysql/Makefile.am2
-rw-r--r--plugins/ommysql/ommysql.c10
-rw-r--r--plugins/ompgsql/.cvsignore6
-rw-r--r--plugins/ompgsql/Makefile.am2
-rw-r--r--plugins/ompgsql/ompgsql.c8
-rw-r--r--plugins/omrelp/.cvsignore6
-rw-r--r--plugins/omrelp/Makefile.am2
-rw-r--r--plugins/omrelp/omrelp.c21
-rw-r--r--plugins/omsnmp/.cvsignore6
-rw-r--r--plugins/omsnmp/Makefile.am2
-rw-r--r--plugins/omsnmp/omsnmp.c14
-rw-r--r--plugins/omtesting/.cvsignore6
-rw-r--r--plugins/omtesting/Makefile.am2
-rw-r--r--plugins/omtesting/omtesting.c2
51 files changed, 446 insertions, 255 deletions
diff --git a/plugins/im3195/Makefile.am b/plugins/im3195/Makefile.am
new file mode 100644
index 00000000..bfceb71e
--- /dev/null
+++ b/plugins/im3195/Makefile.am
@@ -0,0 +1,8 @@
+pkglib_LTLIBRARIES = im3195.la
+
+im3195_la_SOURCES = im3195.c
+im3195_la_CPPFLAGS = $(rsrt_cflags) $(pthreads_cflags) $(LIBLOGGING_CFLAGS)
+im3195_la_LDFLAGS = -module -avoid-version
+im3195_la_LIBADD = $(LIBLOGGING_LIBS)
+
+EXTRA_DIST =
diff --git a/plugins/im3195/im3195.c b/plugins/im3195/im3195.c
new file mode 100644
index 00000000..32dd8dc1
--- /dev/null
+++ b/plugins/im3195/im3195.c
@@ -0,0 +1,167 @@
+/**
+ * The rfc3195 input module.
+ *
+ * Please note that this file replaces the rfc3195d daemon that was
+ * also present in pre-v3 versions of rsyslog.
+ *
+ * WARNING: due to no demand at all for RFC3195, we have converted rfc3195d
+ * to this input module, but we have NOT conducted any testing. Also,
+ * the module does not yet properly handle the recovery case. If someone
+ * intends to put this module into production, good testing should be
+ * made and it also is a good idea to notify me that you intend to use
+ * it in production. In this case, I'll probably give the module another
+ * cleanup. I don't do this now because so far it looks just like a big
+ * waste of time. -- rgerhards, 2008-04-16
+ *
+ * \author Rainer Gerhards <rgerhards@adiscon.com>
+ *
+ * Copyright 2003-2008 Rainer Gerhards and Adiscon GmbH.
+ *
+ * This file is part of rsyslog.
+ *
+ * Rsyslog is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rsyslog is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * A copy of the GPL can be found in the file "COPYING" in this distribution.
+ */
+#include "config.h"
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/errno.h>
+#include <assert.h>
+#include "rsyslog.h"
+#include "dirty.h"
+#include "liblogging/liblogging.h"
+#include "liblogging/srAPI.h"
+#include "liblogging/syslogmessage.h"
+#include "module-template.h"
+#include "cfsysline.h"
+#include "errmsg.h"
+
+MODULE_TYPE_INPUT
+
+/* Module static data */
+DEF_IMOD_STATIC_DATA
+DEFobjCurrIf(errmsg)
+
+/* configuration settings */
+static int listenPort = 601;
+
+/* we use a global API object below, because this listener is
+ * not very complex. As such, this hack should not harm anything.
+ * rgerhards, 2005-10-12
+ */
+static srAPIObj* pAPI;
+
+
+/* This method is called when a message has been fully received.
+ * It passes the received message to the rsyslog main message
+ * queue. Please note that this callback is synchronous, thus
+ * liblogging will be on hold until it returns. This is important
+ * to note because in an error case we might stay in this code
+ * for an extended amount of time. So far, we think this is the
+ * best solution, but real-world experience might tell us a
+ * different truth ;)
+ */
+void OnReceive(srAPIObj __attribute__((unused)) *pMyAPI, srSLMGObj* pSLMG)
+{
+ uchar *pszRawMsg;
+ uchar *fromHost = (uchar*) "[unset]"; /* TODO: get hostname */
+ uchar *fromHostIP = (uchar*) "[unset]"; /* TODO: get hostname */
+
+ srSLMGGetRawMSG(pSLMG, &pszRawMsg);
+
+ parseAndSubmitMessage(fromHost, fromHostIP, pszRawMsg, strlen((char*)pszRawMsg),
+ MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_FULL_DELAY);
+}
+
+
+BEGINrunInput
+CODESTARTrunInput
+ /* this is an endless loop - it is terminated when the thread is
+ * signalled to do so. This, however, is handled by the framework,
+ * right into the sleep below.
+ */
+ while(!pThrd->bShallStop) {
+ /* now move the listener to running state. Control will only
+ * return after SIGUSR1.
+ */
+ if((iRet = srAPIRunListener(pAPI)) != SR_RET_OK) {
+ errmsg.LogError(0, NO_ERRCODE, "error %d running liblogging listener - im3195 is defunct", iRet);
+ FINALIZE; /* this causes im3195 to become defunct; TODO: recovery handling */
+ }
+ }
+finalize_it:
+ENDrunInput
+
+
+BEGINwillRun
+CODESTARTwillRun
+ if((pAPI = srAPIInitLib()) == NULL) {
+ errmsg.LogError(0, NO_ERRCODE, "error initializing liblogging - im3195 is defunct");
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+
+ if((iRet = srAPISetOption(pAPI, srOPTION_BEEP_LISTENPORT, listenPort)) != SR_RET_OK) {
+ errmsg.LogError(0, NO_ERRCODE, "error %d setting liblogging listen port - im3195 is defunct", iRet);
+ FINALIZE;
+ }
+
+ if((iRet = srAPISetupListener(pAPI, OnReceive)) != SR_RET_OK) {
+ errmsg.LogError(0, NO_ERRCODE, "error %d setting up liblogging listener - im3195 is defunct", iRet);
+ FINALIZE;
+ }
+
+finalize_it:
+ENDwillRun
+
+
+BEGINafterRun
+CODESTARTafterRun
+ dbgprintf("Shutting down rfc3195d. Be patient, this can take up to 30 seconds...\n");
+ srAPIShutdownListener(pAPI);
+ENDafterRun
+
+
+BEGINmodExit
+CODESTARTmodExit
+ srAPIExitLib(pAPI); /* terminate liblogging */
+ /* release objects we used */
+ objRelease(errmsg, CORE_COMPONENT);
+ENDmodExit
+
+
+BEGINqueryEtryPt
+CODESTARTqueryEtryPt
+CODEqueryEtryPt_STD_IMOD_QUERIES
+ENDqueryEtryPt
+
+static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
+{
+ listenPort = 601;
+ return RS_RET_OK;
+}
+
+
+BEGINmodInit()
+CODESTARTmodInit
+ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
+CODEmodInit_QueryRegCFSLineHdlr
+ CHKiRet(objUse(errmsg, CORE_COMPONENT));
+
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"input3195listenport", 0, eCmdHdlrInt, NULL, &listenPort, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
+ENDmodInit
+/* vim:set ai:
+ */
diff --git a/plugins/imfile/Makefile.am b/plugins/imfile/Makefile.am
index 23b64d1b..a4011d12 100644
--- a/plugins/imfile/Makefile.am
+++ b/plugins/imfile/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imfile.la
imfile_la_SOURCES = imfile.c
-imfile_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+imfile_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
imfile_la_LDFLAGS = -module -avoid-version
imfile_la_LIBADD =
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index 75e54f04..dbdf6b94 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -36,13 +36,14 @@
# include <sys/stat.h>
#endif
#include "rsyslog.h" /* error codes etc... */
-#include "syslogd.h"
+#include "dirty.h"
#include "cfsysline.h" /* access to config file objects */
#include "module-template.h" /* generic module interface code - very important, read it! */
#include "srUtils.h" /* some utility functions */
#include "msg.h"
#include "stream.h"
#include "errmsg.h"
+#include "glbl.h"
#include "datetime.h"
MODULE_TYPE_INPUT /* must be present for input modules, do not remove */
@@ -52,6 +53,7 @@ MODULE_TYPE_INPUT /* must be present for input modules, do not remove */
/* Module static data */
DEF_IMOD_STATIC_DATA /* must be present, starts static data */
DEFobjCurrIf(errmsg)
+DEFobjCurrIf(glbl)
DEFobjCurrIf(datetime)
typedef struct fileInfo_s {
@@ -95,7 +97,7 @@ static rsRetVal enqLine(fileInfo_t *pInfo, cstr_t *cstrLine)
MsgSetUxTradMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine));
MsgSetRawMsg(pMsg, (char*)rsCStrGetSzStr(cstrLine));
MsgSetMSG(pMsg, (char*)rsCStrGetSzStr(cstrLine));
- MsgSetHOSTNAME(pMsg, (char*)LocalHostName);
+ MsgSetHOSTNAME(pMsg, (char*)glbl.GetLocalHostName());
MsgSetTAG(pMsg, (char*)pInfo->pszTag);
pMsg->iFacility = LOG_FAC(pInfo->iFacility);
pMsg->iSeverity = LOG_PRI(pInfo->iSeverity);
@@ -121,7 +123,7 @@ openFile(fileInfo_t *pThis)
/* Construct file name */
lenSFNam = snprintf((char*)pszSFNam, sizeof(pszSFNam) / sizeof(uchar), "%s/%s",
- (char*) glblGetWorkDir(), (char*)pThis->pszStateFile);
+ (char*) glbl.GetWorkDir(), (char*)pThis->pszStateFile);
/* check if the file exists */
if(stat((char*) pszSFNam, &stat_buf) == -1) {
@@ -179,7 +181,10 @@ static void pollFileCancelCleanup(void *pArg)
rsCStrDestruct(ppCStr);
ENDfunc;
}
+
+
/* poll a file, need to check file rollover etc. open file if not open */
+#pragma GCC diagnostic ignored "-Wempty-body"
static rsRetVal pollFile(fileInfo_t *pThis, int *pbHadFileData)
{
DEFiRet;
@@ -208,6 +213,7 @@ finalize_it:
RETiRet;
}
+#pragma GCC diagnostic warning "-Wempty-body"
/* This function is the cancel cleanup handler. It is called when rsyslog decides the
@@ -264,6 +270,7 @@ inputModuleCleanup(void __attribute__((unused)) *arg)
* On spamming the main queue: keep in mind that it will automatically rate-limit
* ourselfes if we begin to overrun it. So we really do not need to care here.
*/
+#pragma GCC diagnostic ignored "-Wempty-body"
BEGINrunInput
int i;
int bHadFileData; /* were there at least one file with data during this run? */
@@ -296,6 +303,7 @@ CODESTARTrunInput
pthread_cleanup_pop(0); /* just for completeness, but never called... */
RETiRet; /* use it to make sure the housekeeping is done! */
ENDrunInput
+#pragma GCC diagnostic warning "-Wempty-body"
/* END no-touch zone *
* ------------------------------------------------------------------------------------------ */
@@ -310,7 +318,7 @@ ENDrunInput
BEGINwillRun
CODESTARTwillRun
if(iFilPtr == 0) {
- errmsg.LogError(NO_ERRCODE, "No files configured to be monitored");
+ errmsg.LogError(0, RS_RET_NO_RUN, "No files configured to be monitored");
ABORT_FINALIZE(RS_RET_NO_RUN);
}
@@ -334,7 +342,7 @@ persistStrmState(fileInfo_t *pInfo)
/* TODO: create a function persistObj in obj.c? */
CHKiRet(strmConstruct(&psSF));
- CHKiRet(strmSetDir(psSF, glblGetWorkDir(), strlen((char*)glblGetWorkDir())));
+ CHKiRet(strmSetDir(psSF, glbl.GetWorkDir(), strlen((char*)glbl.GetWorkDir())));
CHKiRet(strmSettOperationsMode(psSF, STREAMMODE_WRITE));
CHKiRet(strmSetiAddtlOpenFlags(psSF, O_TRUNC));
CHKiRet(strmSetsType(psSF, STREAMTYPE_FILE_SINGLE));
@@ -381,6 +389,7 @@ BEGINmodExit
CODESTARTmodExit
/* release objects we used */
objRelease(datetime, CORE_COMPONENT);
+ objRelease(glbl, CORE_COMPONENT);
objRelease(errmsg, CORE_COMPONENT);
ENDmodExit
@@ -438,21 +447,21 @@ static rsRetVal addMonitor(void __attribute__((unused)) *pVal, uchar *pNewVal)
pThis = &files[iFilPtr];
/* TODO: check for strdup() NULL return */
if(pszFileName == NULL) {
- errmsg.LogError(NO_ERRCODE, "imfile error: no file name given, file monitor can not be created");
+ errmsg.LogError(0, RS_RET_CONFIG_ERROR, "imfile error: no file name given, file monitor can not be created");
ABORT_FINALIZE(RS_RET_CONFIG_ERROR);
} else {
pThis->pszFileName = (uchar*) strdup((char*) pszFileName);
}
if(pszFileTag == NULL) {
- errmsg.LogError(NO_ERRCODE, "imfile error: no tag value given , file monitor can not be created");
+ errmsg.LogError(0, RS_RET_CONFIG_ERROR, "imfile error: no tag value given , file monitor can not be created");
ABORT_FINALIZE(RS_RET_CONFIG_ERROR);
} else {
pThis->pszTag = (uchar*) strdup((char*) pszFileTag);
}
if(pszStateFile == NULL) {
- errmsg.LogError(NO_ERRCODE, "imfile error: not state file name given, file monitor can not be created");
+ errmsg.LogError(0, RS_RET_CONFIG_ERROR, "imfile error: not state file name given, file monitor can not be created");
ABORT_FINALIZE(RS_RET_CONFIG_ERROR);
} else {
pThis->pszStateFile = (uchar*) strdup((char*) pszStateFile);
@@ -461,7 +470,7 @@ static rsRetVal addMonitor(void __attribute__((unused)) *pVal, uchar *pNewVal)
pThis->iSeverity = iSeverity;
pThis->iFacility = iFacility;
} else {
- errmsg.LogError(NO_ERRCODE, "Too many file monitors configured - ignoring this one");
+ errmsg.LogError(0, RS_RET_OUT_OF_DESRIPTORS, "Too many file monitors configured - ignoring this one");
ABORT_FINALIZE(RS_RET_OUT_OF_DESRIPTORS);
}
@@ -488,6 +497,7 @@ CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
CHKiRet(objUse(datetime, CORE_COMPONENT));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilename", 0, eCmdHdlrGetWord,
diff --git a/plugins/imgssapi/.cvsignore b/plugins/imgssapi/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/imgssapi/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/imgssapi/Makefile.am b/plugins/imgssapi/Makefile.am
index 42a243f4..a5cce320 100644
--- a/plugins/imgssapi/Makefile.am
+++ b/plugins/imgssapi/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imgssapi.la
imgssapi_la_SOURCES = imgssapi.c
-imgssapi_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+imgssapi_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
imgssapi_la_LDFLAGS = -module -avoid-version
imgssapi_la_LIBADD = $(gss_libs)
diff --git a/plugins/imgssapi/imgssapi.c b/plugins/imgssapi/imgssapi.c
index 74d5d5c5..766cb519 100644
--- a/plugins/imgssapi/imgssapi.c
+++ b/plugins/imgssapi/imgssapi.c
@@ -45,7 +45,7 @@
#endif
#include <gssapi/gssapi.h>
#include "rsyslog.h"
-#include "syslogd.h"
+#include "dirty.h"
#include "cfsysline.h"
#include "module-template.h"
#include "net.h"
@@ -54,6 +54,7 @@
#include "tcpsrv.h"
#include "tcps_sess.h"
#include "errmsg.h"
+#include "netstrm.h"
MODULE_TYPE_INPUT
@@ -67,7 +68,7 @@ MODULE_TYPE_INPUT
static rsRetVal addGSSListener(void __attribute__((unused)) *pVal, uchar *pNewVal);
static int TCPSessGSSInit(void);
static void TCPSessGSSClose(tcps_sess_t* pSess);
-static int TCPSessGSSRecv(tcps_sess_t *pSess, void *buf, size_t buf_len);
+static rsRetVal TCPSessGSSRecv(tcps_sess_t *pSess, void *buf, size_t buf_len, ssize_t *);
static rsRetVal onSessAccept(tcpsrv_t *pThis, tcps_sess_t *ppSess);
static rsRetVal OnSessAcceptGSS(tcpsrv_t *pThis, tcps_sess_t *ppSess);
@@ -77,6 +78,7 @@ DEFobjCurrIf(tcpsrv)
DEFobjCurrIf(tcps_sess)
DEFobjCurrIf(gssutil)
DEFobjCurrIf(errmsg)
+DEFobjCurrIf(netstrm)
DEFobjCurrIf(net)
static tcpsrv_t *pOurTcpsrv = NULL; /* our TCP server(listener) TODO: change for multiple instances */
@@ -241,11 +243,12 @@ onErrClose(tcps_sess_t *pSess)
/* open the listen sockets */
-static int*
+static rsRetVal
doOpenLstnSocks(tcpsrv_t *pSrv)
{
int *pRet = NULL;
gsssrv_t *pGSrv;
+ DEFiRet;
ISOBJ_TYPE_assert(pSrv, tcpsrv);
pGSrv = pSrv->pUsr;
@@ -255,39 +258,44 @@ doOpenLstnSocks(tcpsrv_t *pSrv)
if(pGSrv->allowedMethods) {
if(pGSrv->allowedMethods & ALLOWEDMETHOD_GSS) {
if(TCPSessGSSInit()) {
- errmsg.LogError(NO_ERRCODE, "GSS-API initialization failed\n");
+ errmsg.LogError(0, NO_ERRCODE, "GSS-API initialization failed\n");
pGSrv->allowedMethods &= ~(ALLOWEDMETHOD_GSS);
}
}
if(pGSrv->allowedMethods) {
/* fallback to plain TCP */
- if((pRet = tcpsrv.create_tcp_socket(pSrv)) != NULL) {
- dbgprintf("Opened %d syslog TCP port(s).\n", *pRet);
- }
+ CHKiRet(tcpsrv.create_tcp_socket(pSrv));
+ dbgprintf("Opened %d syslog TCP port(s).\n", *pRet);
}
}
- return pRet;
+finalize_it:
+ RETiRet;
}
-static int
-doRcvData(tcps_sess_t *pSess, char *buf, size_t lenBuf)
+static rsRetVal
+doRcvData(tcps_sess_t *pSess, char *buf, size_t lenBuf, ssize_t *piLenRcvd)
{
- int state;
+ DEFiRet;
int allowedMethods;
gss_sess_t *pGSess;
assert(pSess != NULL);
assert(pSess->pUsr != NULL);
pGSess = (gss_sess_t*) pSess->pUsr;
+ assert(piLenRcvd != NULL);
allowedMethods = pGSess->allowedMethods;
- if(allowedMethods & ALLOWEDMETHOD_GSS)
- state = TCPSessGSSRecv(pSess, buf, lenBuf);
- else
- state = recv(pSess->sock, buf, lenBuf, 0);
- return state;
+ if(allowedMethods & ALLOWEDMETHOD_GSS) {
+ CHKiRet(TCPSessGSSRecv(pSess, buf, lenBuf, piLenRcvd));
+ } else {
+ *piLenRcvd = lenBuf;
+ CHKiRet(netstrm.Rcv(pSess->pStrm, (uchar*) buf, piLenRcvd) != RS_RET_OK);
+ }
+
+finalize_it:
+ RETiRet;
}
@@ -391,7 +399,7 @@ OnSessAcceptGSS(tcpsrv_t *pThis, tcps_sess_t *pSess)
dbgprintf("GSS-API Trying to accept TCP session %p\n", pSess);
- fdSess = pSess->sock; // TODO: method access!
+ CHKiRet(netstrm.GetSock(pSess->pStrm, &fdSess)); // TODO: method access!
if (allowedMethods & ALLOWEDMETHOD_TCP) {
int len;
fd_set fds;
@@ -405,7 +413,7 @@ OnSessAcceptGSS(tcpsrv_t *pThis, tcps_sess_t *pSess)
ret = select(fdSess + 1, &fds, NULL, NULL, &tv);
} while (ret < 0 && errno == EINTR);
if (ret < 0) {
- errmsg.LogError(NO_ERRCODE, "TCP session %p will be closed, error ignored\n", pSess);
+ errmsg.LogError(0, RS_RET_ERR, "TCP session %p will be closed, error ignored\n", pSess);
ABORT_FINALIZE(RS_RET_ERR); // TODO: define good error codes
} else if (ret == 0) {
dbgprintf("GSS-API Reverting to plain TCP\n");
@@ -420,7 +428,7 @@ OnSessAcceptGSS(tcpsrv_t *pThis, tcps_sess_t *pSess)
if (ret == 0)
dbgprintf("GSS-API Connection closed by peer\n");
else
- errmsg.LogError(NO_ERRCODE, "TCP(GSS) session %p will be closed, error ignored\n", pSess);
+ errmsg.LogError(0, RS_RET_ERR, "TCP(GSS) session %p will be closed, error ignored\n", pSess);
ABORT_FINALIZE(RS_RET_ERR); // TODO: define good error codes
}
@@ -440,7 +448,7 @@ OnSessAcceptGSS(tcpsrv_t *pThis, tcps_sess_t *pSess)
if (ret == 0)
dbgprintf("GSS-API Connection closed by peer\n");
else
- errmsg.LogError(NO_ERRCODE, "TCP session %p will be closed, error ignored\n", pSess);
+ errmsg.LogError(0, NO_ERRCODE, "TCP session %p will be closed, error ignored\n", pSess);
ABORT_FINALIZE(RS_RET_ERR); // TODO: define good error codes
}
}
@@ -462,7 +470,7 @@ OnSessAcceptGSS(tcpsrv_t *pThis, tcps_sess_t *pSess)
sess_flags = &pGSess->gss_flags;
do {
if (gssutil.recv_token(fdSess, &recv_tok) <= 0) {
- errmsg.LogError(NO_ERRCODE, "TCP session %p will be closed, error ignored\n", pSess);
+ errmsg.LogError(0, NO_ERRCODE, "TCP session %p will be closed, error ignored\n", pSess);
ABORT_FINALIZE(RS_RET_ERR); // TODO: define good error codes
}
maj_stat = gss_accept_sec_context(&acc_sec_min_stat, context, gss_server_creds,
@@ -481,7 +489,7 @@ OnSessAcceptGSS(tcpsrv_t *pThis, tcps_sess_t *pSess)
dbgprintf("GSS-API Reverting to plain TCP\n");
dbgprintf("tcp session socket with new data: #%d\n", fdSess);
if(tcps_sess.DataRcvd(pSess, buf, ret) != RS_RET_OK) {
- errmsg.LogError(NO_ERRCODE, "Tearing down TCP Session %p - see "
+ errmsg.LogError(0, NO_ERRCODE, "Tearing down TCP Session %p - see "
"previous messages for reason(s)\n", pSess);
ABORT_FINALIZE(RS_RET_ERR); // TODO: define good error codes
}
@@ -494,7 +502,7 @@ OnSessAcceptGSS(tcpsrv_t *pThis, tcps_sess_t *pSess)
if (send_tok.length != 0) {
if(gssutil.send_token(fdSess, &send_tok) < 0) {
gss_release_buffer(&min_stat, &send_tok);
- errmsg.LogError(NO_ERRCODE, "TCP session %p will be closed, error ignored\n", pSess);
+ errmsg.LogError(0, NO_ERRCODE, "TCP session %p will be closed, error ignored\n", pSess);
if (*context != GSS_C_NO_CONTEXT)
gss_delete_sec_context(&min_stat, context, GSS_C_NO_BUFFER);
ABORT_FINALIZE(RS_RET_ERR); // TODO: define good error codes
@@ -521,25 +529,26 @@ finalize_it:
}
-/* returns: number of bytes read or -1 on error
- * Replaces recv() for gssapi connections.
+/* Replaces recv() for gssapi connections.
*/
-int TCPSessGSSRecv(tcps_sess_t *pSess, void *buf, size_t buf_len)
+int TCPSessGSSRecv(tcps_sess_t *pSess, void *buf, size_t buf_len, ssize_t *piLenRcvd)
{
+ DEFiRet;
gss_buffer_desc xmit_buf, msg_buf;
gss_ctx_id_t *context;
OM_uint32 maj_stat, min_stat;
int fdSess;
int conf_state;
- int state, len;
+ int state;
gss_sess_t *pGSess;
assert(pSess->pUsr != NULL);
+ assert(piLenRcvd != NULL);
pGSess = (gss_sess_t*) pSess->pUsr;
- fdSess = pSess->sock;
+ netstrm.GetSock(pSess->pStrm, &fdSess); // TODO: method access, CHKiRet!
if ((state = gssutil.recv_token(fdSess, &xmit_buf)) <= 0)
- return state;
+ ABORT_FINALIZE(RS_RET_GSS_ERR);
context = &pGSess->gss_context;
maj_stat = gss_unwrap(&min_stat, *context, &xmit_buf, &msg_buf,
@@ -550,18 +559,19 @@ int TCPSessGSSRecv(tcps_sess_t *pSess, void *buf, size_t buf_len)
free(xmit_buf.value);
xmit_buf.value = 0;
}
- return (-1);
+ ABORT_FINALIZE(RS_RET_GSS_ERR);
}
if (xmit_buf.value) {
free(xmit_buf.value);
xmit_buf.value = 0;
}
- len = msg_buf.length < buf_len ? msg_buf.length : buf_len;
- memcpy(buf, msg_buf.value, len);
+ *piLenRcvd = msg_buf.length < buf_len ? msg_buf.length : buf_len;
+ memcpy(buf, msg_buf.value, *piLenRcvd);
gss_release_buffer(&min_stat, &msg_buf);
- return len;
+finalize_it:
+ RETiRet;
}
@@ -638,6 +648,7 @@ CODESTARTmodExit
objRelease(tcpsrv, LM_TCPSRV_FILENAME);
objRelease(gssutil, LM_GSSUTIL_FILENAME);
objRelease(errmsg, CORE_COMPONENT);
+ objRelease(netstrm, LM_NETSTRM_FILENAME);
objRelease(net, LM_NET_FILENAME);
ENDmodExit
@@ -684,6 +695,7 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(tcpsrv, LM_TCPSRV_FILENAME));
CHKiRet(objUse(gssutil, LM_GSSUTIL_FILENAME));
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(netstrm, LM_NETSTRM_FILENAME));
CHKiRet(objUse(net, LM_NET_FILENAME));
/* register config file handlers */
diff --git a/plugins/imklog/.cvsignore b/plugins/imklog/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/imklog/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/imklog/Makefile.am b/plugins/imklog/Makefile.am
index 246b3306..8f50cfb2 100644
--- a/plugins/imklog/Makefile.am
+++ b/plugins/imklog/Makefile.am
@@ -11,6 +11,6 @@ if ENABLE_IMKLOG_LINUX
imklog_la_SOURCES += linux.c module.h ksym.c ksyms.h ksym_mod.c
endif
-imklog_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+imklog_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
imklog_la_LDFLAGS = -module -avoid-version
imklog_la_LIBADD =
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 38f2a23c..f6935a34 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -45,21 +45,23 @@
#include <stdarg.h>
#include <ctype.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "cfsysline.h"
#include "obj.h"
#include "msg.h"
#include "module-template.h"
#include "datetime.h"
#include "imklog.h"
+#include "glbl.h"
MODULE_TYPE_INPUT
/* Module static data */
DEF_IMOD_STATIC_DATA
DEFobjCurrIf(datetime)
+DEFobjCurrIf(glbl)
-/* configuration settings TODO: move to instance data? */
+/* configuration settings */
int dbgPrintSymbols = 0; /* this one is extern so the helpers can access it! */
int symbols_twice = 0;
int use_syscall = 0;
@@ -95,7 +97,9 @@ enqMsg(uchar *msg, uchar* pszTag, int iFacility, int iSeverity)
MsgSetUxTradMsg(pMsg, (char*)msg);
MsgSetRawMsg(pMsg, (char*)msg);
MsgSetMSG(pMsg, (char*)msg);
- MsgSetHOSTNAME(pMsg, (char*)LocalHostName);
+ MsgSetRcvFrom(pMsg, (char*)glbl.GetLocalHostName());
+ MsgSetRcvFromIP(pMsg, (uchar*)"127.0.0.1");
+ MsgSetHOSTNAME(pMsg, (char*)glbl.GetLocalHostName());
MsgSetTAG(pMsg, (char*)pszTag);
pMsg->iFacility = LOG_FAC(iFacility);
pMsg->iSeverity = LOG_PRI(iSeverity);
@@ -225,6 +229,7 @@ ENDafterRun
BEGINmodExit
CODESTARTmodExit
/* release objects we used */
+ objRelease(glbl, CORE_COMPONENT);
objRelease(datetime, CORE_COMPONENT);
ENDmodExit
@@ -251,6 +256,7 @@ CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(datetime, CORE_COMPONENT));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
iFacilIntMsg = klogFacilIntMsg();
diff --git a/plugins/imklog/imklog.h b/plugins/imklog/imklog.h
index a37ecc9e..0847140b 100644
--- a/plugins/imklog/imklog.h
+++ b/plugins/imklog/imklog.h
@@ -28,7 +28,7 @@
#define IMKLOG_H_INCLUDED 1
#include "rsyslog.h"
-#include "syslogd.h"
+#include "dirty.h"
/* interface to "drivers"
* the platform specific drivers must implement these entry points. Only one
diff --git a/plugins/imklog/linux.c b/plugins/imklog/linux.c
index 25f012c3..862f5856 100644
--- a/plugins/imklog/linux.c
+++ b/plugins/imklog/linux.c
@@ -32,7 +32,6 @@
#include <signal.h>
#include <string.h>
#include <pthread.h>
-#include "syslogd.h"
#include "cfsysline.h"
#include "template.h"
#include "msg.h"
@@ -147,9 +146,7 @@ static enum LOGSRC GetKernelLogSrc(void)
if ( (kmsg = open(_PATH_KLOG, O_RDONLY)) < 0 )
{
- char sz[512];
- snprintf(sz, sizeof(sz), "imklog: Cannot open proc file system, %d - %s.\n", errno, strerror(errno));
- logmsgInternal(LOG_SYSLOG|LOG_ERR, sz, ADDDATE);
+ imklogLogIntMsg(LOG_ERR, "imklog: Cannot open proc file system, %d.\n", errno);
ksyslog(7, NULL, 0); /* TODO: check this, implement more */
return(none);
}
@@ -428,11 +425,9 @@ static void LogKernelLine(void)
memset(log_buffer, '\0', sizeof(log_buffer));
if ( (rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer)-1)) < 0 )
{
- char sz[512];
if(errno == EINTR)
return;
- snprintf(sz, sizeof(sz), "imklog: Error return from sys_sycall: %d - %s\n", errno, strerror(errno));
- logmsgInternal(LOG_SYSLOG|LOG_ERR, sz, ADDDATE);
+ imklogLogIntMsg(LOG_ERR, "imklog Error return from sys_sycall: %d\n", errno);
}
else
LogLine(log_buffer, rdcnt);
diff --git a/plugins/immark/.cvsignore b/plugins/immark/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/immark/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/immark/Makefile.am b/plugins/immark/Makefile.am
index 3dc0e408..9c0f8f64 100644
--- a/plugins/immark/Makefile.am
+++ b/plugins/immark/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = immark.la
immark_la_SOURCES = immark.c immark.h
-immark_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+immark_la_CPPFLAGS = $(rsrt_cflags) -I$(top_srcdir) $(pthreads_cflags)
immark_la_LDFLAGS = -module -avoid-version
immark_la_LIBADD =
diff --git a/plugins/immark/immark.c b/plugins/immark/immark.c
index 0bc31995..bdca4d58 100644
--- a/plugins/immark/immark.c
+++ b/plugins/immark/immark.c
@@ -37,9 +37,10 @@
#include <signal.h>
#include <string.h>
#include <pthread.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "cfsysline.h"
#include "module-template.h"
+#include "errmsg.h"
MODULE_TYPE_INPUT
@@ -75,7 +76,7 @@ CODESTARTrunInput
* rgerhards, 2007-12-17
*/
CHKiRet(thrdSleep(pThrd, iMarkMessagePeriod, 0)); /* seconds, micro seconds */
- logmsgInternal(LOG_INFO, "-- MARK --", ADDDATE|MARK);
+ logmsgInternal(NO_ERRCODE, LOG_INFO, (uchar*)"-- MARK --", ADDDATE|MARK);
}
finalize_it:
return iRet;
diff --git a/plugins/imrelp/.cvsignore b/plugins/imrelp/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/imrelp/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/imrelp/Makefile.am b/plugins/imrelp/Makefile.am
index 53c9322c..a96e2b42 100644
--- a/plugins/imrelp/Makefile.am
+++ b/plugins/imrelp/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imrelp.la
imrelp_la_SOURCES = imrelp.c
-imrelp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(RELP_CFLAGS)
+imrelp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(RELP_CFLAGS) $(rsrt_cflags)
imrelp_la_LDFLAGS = -module -avoid-version
imrelp_la_LIBADD = $(RELP_LIBS)
diff --git a/plugins/imrelp/imrelp.c b/plugins/imrelp/imrelp.c
index b7308016..5c9bbce1 100644
--- a/plugins/imrelp/imrelp.c
+++ b/plugins/imrelp/imrelp.c
@@ -38,7 +38,7 @@
#include <sys/socket.h>
#include <librelp.h>
#include "rsyslog.h"
-#include "syslogd.h"
+#include "dirty.h"
#include "cfsysline.h"
#include "module-template.h"
#include "net.h"
@@ -76,12 +76,14 @@ isPermittedHost(struct sockaddr *addr, char *fromHostFQDN, void __attribute__((u
* are different from our rsRetVal. So we can simply use our own iRet system
* to fulfill the requirement.
* rgerhards, 2008-03-21
+ * TODO: we currently do not receive the remote hosts's IP. As a work-around, we
+ * use "???" for the time being. -- rgerhards, 2008-05-16
*/
static relpRetVal
onSyslogRcv(uchar *pHostname, uchar __attribute__((unused)) *pIP, uchar *pMsg, size_t lenMsg)
{
DEFiRet;
- parseAndSubmitMessage((char*)pHostname, (char*)pMsg, lenMsg, MSG_PARSE_HOSTNAME,
+ parseAndSubmitMessage(pHostname, (uchar*) "[unset]", pMsg, lenMsg, MSG_PARSE_HOSTNAME,
NOFLAG, eFLOWCTL_LIGHT_DELAY);
RETiRet;
diff --git a/plugins/imtcp/.cvsignore b/plugins/imtcp/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/imtcp/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/imtcp/Makefile.am b/plugins/imtcp/Makefile.am
index fe43cd98..de746a95 100644
--- a/plugins/imtcp/Makefile.am
+++ b/plugins/imtcp/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imtcp.la
imtcp_la_SOURCES = imtcp.c
-imtcp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+imtcp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
imtcp_la_LDFLAGS = -module -avoid-version
imtcp_la_LIBADD =
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index 7baa95f2..f01a9f0f 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -23,6 +23,20 @@
* A copy of the GPL can be found in the file "COPYING" in this distribution.
*/
+/* This note shall explain the calling sequence while we do not have
+ * have full RainerScript support for (TLS) sender authentication:
+ *
+ * imtcp --> tcpsrv --> netstrms (this sequence stored pPermPeers in netstrms class)
+ * then a callback (doOpenLstnSocks) into imtcp happens, which in turn calls
+ * into tcpsrv.create_tcp_socket(),
+ * which calls into netstrm.LstnInit(), which receives a pointer to netstrms obj
+ * which calls into the driver function LstnInit (again, netstrms obj passed)
+ * which finally calls back into netstrms obj's get functions to obtain the auth
+ * parameters and then applies them to the driver object instance
+ *
+ * rgerhards, 2008-05-19
+ */
+
#include "config.h"
#include <stdlib.h>
#include <assert.h>
@@ -39,11 +53,14 @@
#include <fcntl.h>
#endif
#include "rsyslog.h"
-#include "syslogd.h"
+#include "dirty.h"
#include "cfsysline.h"
#include "module-template.h"
#include "net.h"
+#include "netstrm.h"
+#include "errmsg.h"
#include "tcpsrv.h"
+#include "net.h" /* for permittedPeers, may be removed when this is removed */
MODULE_TYPE_INPUT
@@ -52,12 +69,18 @@ DEF_IMOD_STATIC_DATA
DEFobjCurrIf(tcpsrv)
DEFobjCurrIf(tcps_sess)
DEFobjCurrIf(net)
+DEFobjCurrIf(netstrm)
+DEFobjCurrIf(errmsg)
/* Module static data */
static tcpsrv_t *pOurTcpsrv = NULL; /* our TCP server(listener) TODO: change for multiple instances */
+static permittedPeers_t *pPermPeersRoot = NULL;
+
/* config settings */
static int iTCPSessMax = 200; /* max number of sessions */
+static int iStrmDrvrMode = 0; /* mode for stream driver, driver-dependent (0 mostly means plain tcp) */
+static uchar *pszStrmDrvrAuthMode = NULL; /* authentication mode to use */
/* callbacks */
@@ -70,7 +93,7 @@ isPermittedHost(struct sockaddr *addr, char *fromHostFQDN, void __attribute__((u
}
-static int*
+static rsRetVal
doOpenLstnSocks(tcpsrv_t *pSrv)
{
ISOBJ_TYPE_assert(pSrv, tcpsrv);
@@ -78,14 +101,17 @@ doOpenLstnSocks(tcpsrv_t *pSrv)
}
-static int
-doRcvData(tcps_sess_t *pSess, char *buf, size_t lenBuf)
+static rsRetVal
+doRcvData(tcps_sess_t *pSess, char *buf, size_t lenBuf, ssize_t *piLenRcvd)
{
- int state;
+ DEFiRet;
assert(pSess != NULL);
+ assert(piLenRcvd != NULL);
- state = recv(pSess->sock, buf, lenBuf, 0);
- return state;
+ *piLenRcvd = lenBuf;
+ CHKiRet(netstrm.Rcv(pSess->pStrm, (uchar*) buf, piLenRcvd));
+finalize_it:
+ RETiRet;
}
static rsRetVal
@@ -115,9 +141,23 @@ onErrClose(tcps_sess_t *pSess)
/* ------------------------------ end callbacks ------------------------------ */
+/* set permitted peer -- rgerhards, 2008-05-19
+ */
+static rsRetVal
+setPermittedPeer(void __attribute__((unused)) *pVal, uchar *pszID)
+{
+ DEFiRet;
+ CHKiRet(net.AddPermittedPeer(&pPermPeersRoot, pszID));
+ free(pszID); /* no longer needed, but we need to free as of interface def */
+finalize_it:
+ RETiRet;
+}
+
+
static rsRetVal addTCPListener(void __attribute__((unused)) *pVal, uchar *pNewVal)
{
DEFiRet;
+
if(pOurTcpsrv == NULL) {
CHKiRet(tcpsrv.Construct(&pOurTcpsrv));
CHKiRet(tcpsrv.SetCBIsPermittedHost(pOurTcpsrv, isPermittedHost));
@@ -125,11 +165,25 @@ static rsRetVal addTCPListener(void __attribute__((unused)) *pVal, uchar *pNewVa
CHKiRet(tcpsrv.SetCBOpenLstnSocks(pOurTcpsrv, doOpenLstnSocks));
CHKiRet(tcpsrv.SetCBOnRegularClose(pOurTcpsrv, onRegularClose));
CHKiRet(tcpsrv.SetCBOnErrClose(pOurTcpsrv, onErrClose));
+ CHKiRet(tcpsrv.SetDrvrMode(pOurTcpsrv, iStrmDrvrMode));
+ /* now set optional params, but only if they were actually configured */
+ if(pszStrmDrvrAuthMode != NULL) {
+ CHKiRet(tcpsrv.SetDrvrAuthMode(pOurTcpsrv, pszStrmDrvrAuthMode));
+ }
+ if(pPermPeersRoot != NULL) {
+ CHKiRet(tcpsrv.SetDrvrPermPeers(pOurTcpsrv, pPermPeersRoot));
+ }
+ /* most params set, now start listener */
tcpsrv.configureTCPListen(pOurTcpsrv, (char *) pNewVal);
CHKiRet(tcpsrv.ConstructFinalize(pOurTcpsrv));
}
finalize_it:
+ if(iRet != RS_RET_OK) {
+ errmsg.LogError(0, NO_ERRCODE, "error %d trying to add listener", iRet);
+ if(pOurTcpsrv != NULL)
+ tcpsrv.Destruct(&pOurTcpsrv);
+ }
RETiRet;
}
@@ -170,10 +224,16 @@ CODESTARTmodExit
if(pOurTcpsrv != NULL)
iRet = tcpsrv.Destruct(&pOurTcpsrv);
+ if(pPermPeersRoot != NULL) {
+ net.DestructPermittedPeers(&pPermPeersRoot);
+ }
+
/* release objects we used */
objRelease(net, LM_NET_FILENAME);
+ objRelease(netstrm, LM_NETSTRMS_FILENAME);
objRelease(tcps_sess, LM_TCPSRV_FILENAME);
objRelease(tcpsrv, LM_TCPSRV_FILENAME);
+ objRelease(errmsg, CORE_COMPONENT);
ENDmodExit
@@ -181,6 +241,7 @@ static rsRetVal
resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
{
iTCPSessMax = 200;
+ iStrmDrvrMode = 0;
return RS_RET_OK;
}
@@ -199,14 +260,22 @@ CODEmodInit_QueryRegCFSLineHdlr
pOurTcpsrv = NULL;
/* request objects we use */
CHKiRet(objUse(net, LM_NET_FILENAME));
+ CHKiRet(objUse(netstrm, LM_NETSTRMS_FILENAME));
CHKiRet(objUse(tcps_sess, LM_TCPSRV_FILENAME));
CHKiRet(objUse(tcpsrv, LM_TCPSRV_FILENAME));
+ CHKiRet(objUse(errmsg, CORE_COMPONENT));
/* register config file handlers */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputtcpserverrun", 0, eCmdHdlrGetWord,
addTCPListener, NULL, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputtcpmaxsessions", 0, eCmdHdlrInt,
NULL, &iTCPSessMax, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputtcpserverstreamdrivermode", 0,
+ eCmdHdlrInt, NULL, &iStrmDrvrMode, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputtcpserverstreamdriverauthmode", 0,
+ eCmdHdlrGetWord, NULL, &pszStrmDrvrAuthMode, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputtcpserverstreamdriverpermittedpeer", 0,
+ eCmdHdlrGetWord, setPermittedPeer, NULL, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,
resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit
diff --git a/plugins/imtemplate/Makefile.am b/plugins/imtemplate/Makefile.am
index a9221817..0ea4355e 100644
--- a/plugins/imtemplate/Makefile.am
+++ b/plugins/imtemplate/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imtemplate.la
imtemplate_la_SOURCES = imtemplate.c
-imtemplate_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+imtemplate_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
imtemplate_la_LDFLAGS = -module -avoid-version
imtemplate_la_LIBADD =
diff --git a/plugins/imudp/.cvsignore b/plugins/imudp/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/imudp/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/imudp/Makefile.am b/plugins/imudp/Makefile.am
index 53fdad16..28ee9853 100644
--- a/plugins/imudp/Makefile.am
+++ b/plugins/imudp/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imudp.la
imudp_la_SOURCES = imudp.c
-imudp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+imudp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
imudp_la_LDFLAGS = -module -avoid-version
imudp_la_LIBADD =
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index cda794c3..6d3a075f 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -33,12 +33,13 @@
#include <unistd.h>
#include <netdb.h>
#include "rsyslog.h"
-#include "syslogd.h"
+#include "dirty.h"
#include "net.h"
#include "cfsysline.h"
#include "module-template.h"
#include "srUtils.h"
#include "errmsg.h"
+#include "glbl.h"
MODULE_TYPE_INPUT
@@ -47,6 +48,7 @@ MODULE_TYPE_INPUT
/* Module static data */
DEF_IMOD_STATIC_DATA
DEFobjCurrIf(errmsg)
+DEFobjCurrIf(glbl)
DEFobjCurrIf(net)
static int *udpLstnSocks = NULL; /* Internet datagram sockets, first element is nbr of elements
@@ -133,6 +135,7 @@ BEGINrunInput
struct sockaddr_storage frominet;
socklen_t socklen;
uchar fromHost[NI_MAXHOST];
+ uchar fromHostIP[NI_MAXHOST];
uchar fromHostFQDN[NI_MAXHOST];
ssize_t l;
CODESTARTrunInput
@@ -180,7 +183,7 @@ CODESTARTrunInput
l = recvfrom(udpLstnSocks[i+1], (char*) pRcvBuf, MAXLINE - 1, 0,
(struct sockaddr *)&frominet, &socklen);
if (l > 0) {
- if(net.cvthname(&frominet, fromHost, fromHostFQDN) == RS_RET_OK) {
+ if(net.cvthname(&frominet, fromHost, fromHostFQDN, fromHostIP) == RS_RET_OK) {
dbgprintf("Message from inetd socket: #%d, host: %s\n",
udpLstnSocks[i+1], fromHost);
/* Here we check if a host is permitted to send us
@@ -191,12 +194,12 @@ CODESTARTrunInput
*/
if(net.isAllowedSender(net.pAllowedSenders_UDP,
(struct sockaddr *)&frominet, (char*)fromHostFQDN)) {
- parseAndSubmitMessage((char*)fromHost, (char*) pRcvBuf, l,
+ parseAndSubmitMessage(fromHost, fromHostIP, pRcvBuf, l,
MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_NO_DELAY);
} else {
dbgprintf("%s is not an allowed sender\n", (char*)fromHostFQDN);
- if(option_DisallowWarning) {
- errmsg.LogError(NO_ERRCODE, "UDP message from disallowed sender %s discarded",
+ if(glbl.GetOption_DisallowWarning) {
+ errmsg.LogError(0, NO_ERRCODE, "UDP message from disallowed sender %s discarded",
(char*)fromHost);
}
}
@@ -205,7 +208,7 @@ CODESTARTrunInput
char errStr[1024];
rs_strerror_r(errno, errStr, sizeof(errStr));
dbgprintf("INET socket error: %d = %s.\n", errno, errStr);
- errmsg.LogError(NO_ERRCODE, "recvfrom inet");
+ errmsg.LogError(errno, NO_ERRCODE, "recvfrom inet");
/* should be harmless */
sleep(1);
}
@@ -253,6 +256,7 @@ BEGINmodExit
CODESTARTmodExit
/* release what we no longer need */
objRelease(errmsg, CORE_COMPONENT);
+ objRelease(glbl, CORE_COMPONENT);
objRelease(net, LM_NET_FILENAME);
ENDmodExit
@@ -281,6 +285,7 @@ CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
CHKiRet(objUse(net, LM_NET_FILENAME));
/* register config file handlers */
diff --git a/plugins/imuxsock/.cvsignore b/plugins/imuxsock/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/imuxsock/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/imuxsock/Makefile.am b/plugins/imuxsock/Makefile.am
index e165bb7d..11a0ba3a 100644
--- a/plugins/imuxsock/Makefile.am
+++ b/plugins/imuxsock/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imuxsock.la
imuxsock_la_SOURCES = imuxsock.c
-imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+imuxsock_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
imuxsock_la_LDFLAGS = -module -avoid-version
imuxsock_la_LIBADD =
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index f8798039..5781589f 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -35,11 +35,13 @@
#include <unistd.h>
#include <sys/stat.h>
#include <sys/un.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "cfsysline.h"
#include "module-template.h"
#include "srUtils.h"
#include "errmsg.h"
+#include "net.h"
+#include "glbl.h"
MODULE_TYPE_INPUT
@@ -62,6 +64,7 @@ MODULE_TYPE_INPUT
/* Module static data */
DEF_IMOD_STATIC_DATA
DEFobjCurrIf(errmsg)
+DEFobjCurrIf(glbl)
static int startIndexUxLocalSockets; /* process funix from that index on (used to
* suppress local logging. rgerhards 2005-08-01
@@ -100,8 +103,6 @@ static rsRetVal setSystemLogTimestampIgnore(void __attribute__((unused)) *pVal,
*/
static rsRetVal addLstnSocketName(void __attribute__((unused)) *pVal, uchar *pNewVal)
{
- char errStr[1024];
-
if(nfunix < MAXFUNIX) {
if(*pNewVal == ':') {
funixParseHost[nfunix] = 1;
@@ -113,9 +114,8 @@ static rsRetVal addLstnSocketName(void __attribute__((unused)) *pVal, uchar *pNe
funixn[nfunix++] = pNewVal;
}
else {
- snprintf(errStr, sizeof(errStr), "rsyslogd: Out of unix socket name descriptors, ignoring %s\n",
+ errmsg.LogError(0, NO_ERRCODE, "Out of unix socket name descriptors, ignoring %s\n",
pNewVal);
- logmsgInternal(LOG_SYSLOG|LOG_ERR, errStr, ADDDATE);
}
return RS_RET_OK;
@@ -159,7 +159,7 @@ static int create_unix_socket(const char *path)
SUN_LEN(&sunx)) < 0 ||
chmod(path, 0666) < 0) {
snprintf(line, sizeof(line), "cannot create %s", path);
- errmsg.LogError(NO_ERRCODE, "%s", line);
+ errmsg.LogError(errno, NO_ERRCODE, "%s", line);
dbgprintf("cannot create %s (%d).\n", path, errno);
close(fd);
return -1;
@@ -176,17 +176,18 @@ static rsRetVal readSocket(int fd, int bParseHost, int flags)
{
DEFiRet;
int iRcvd;
- char line[MAXLINE +1];
+ uchar line[MAXLINE +1];
iRcvd = recv(fd, line, MAXLINE - 1, 0);
dbgprintf("Message from UNIX socket: #%d\n", fd);
if (iRcvd > 0) {
- parseAndSubmitMessage((char*)LocalHostName, line, iRcvd, bParseHost, flags, eFLOWCTL_LIGHT_DELAY);
+ parseAndSubmitMessage(glbl.GetLocalHostName(), (uchar*)"127.0.0.1", line,
+ iRcvd, bParseHost, flags, eFLOWCTL_LIGHT_DELAY);
} else if (iRcvd < 0 && errno != EINTR) {
char errStr[1024];
rs_strerror_r(errno, errStr, sizeof(errStr));
dbgprintf("UNIX socket error: %d = %s.\n", errno, errStr);
- errmsg.LogError(NO_ERRCODE, "recvfrom UNIX");
+ errmsg.LogError(errno, NO_ERRCODE, "recvfrom UNIX");
}
RETiRet;
@@ -289,6 +290,8 @@ ENDafterRun
BEGINmodExit
CODESTARTmodExit
+ objRelease(glbl, CORE_COMPONENT);
+ objRelease(errmsg, CORE_COMPONENT);
ENDmodExit
@@ -319,6 +322,7 @@ CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
/* initialize funixn[] array */
for(i = 1 ; i < MAXFUNIX ; ++i) {
@@ -346,6 +350,5 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(omsdRegCFSLineHdlr((uchar *)"systemlogsocketignoremsgtimestamp", 0, eCmdHdlrBinary,
setSystemLogTimestampIgnore, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit
-/*
- * vi:set ai:
+/* vim:set ai:
*/
diff --git a/plugins/omgssapi/.cvsignore b/plugins/omgssapi/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/omgssapi/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/omgssapi/Makefile.am b/plugins/omgssapi/Makefile.am
index 5280a1ce..c2cbe387 100644
--- a/plugins/omgssapi/Makefile.am
+++ b/plugins/omgssapi/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = omgssapi.la
omgssapi_la_SOURCES = omgssapi.c
-omgssapi_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+omgssapi_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
omgssapi_la_LDFLAGS = -module -avoid-version
omgssapi_la_LIBADD = $(gss_libs)
diff --git a/plugins/omgssapi/omgssapi.c b/plugins/omgssapi/omgssapi.c
index 34abfe0a..82fca2db 100644
--- a/plugins/omgssapi/omgssapi.c
+++ b/plugins/omgssapi/omgssapi.c
@@ -43,38 +43,27 @@
#endif
#include <pthread.h>
#include <gssapi/gssapi.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "syslogd-types.h"
#include "srUtils.h"
#include "net.h"
-#include "omfwd.h"
#include "template.h"
#include "msg.h"
-#include "tcpsyslog.h"
#include "cfsysline.h"
#include "module-template.h"
#include "gss-misc.h"
#include "tcpclt.h"
+#include "glbl.h"
#include "errmsg.h"
MODULE_TYPE_OUTPUT
-#define INET_SUSPEND_TIME 60
-/* equal to 1 minute - TODO: see if we can get rid of this now that we have
- * the retry intervals in the engine -- rgerhards, 2008-03-12
- */
-
-#define INET_RETRY_MAX 30 /* maximum of retries for gethostbyname() */
- /* was 10, changed to 30 because we reduced INET_SUSPEND_TIME by one third. So
- * this "fixes" some of implications of it (see comment on INET_SUSPEND_TIME).
- * rgerhards, 2005-07-26
- * TODO: this needs to be reviewed in spite of the new engine, too -- rgerhards, 2008-03-12
- */
/* internal structures
*/
DEF_OMOD_STATIC_DATA
DEFobjCurrIf(errmsg)
+DEFobjCurrIf(glbl)
DEFobjCurrIf(gssutil)
DEFobjCurrIf(tcpclt)
@@ -86,11 +75,9 @@ typedef struct _instanceData {
eDestFORW_SUSP,
eDestFORW_UNKN
} eDestState;
- int iRtryCnt;
struct addrinfo *f_addr;
int compressionLevel; /* 0 - no compression, else level for zlib */
char *port;
- time_t ttSuspend; /* time selector was suspended */
tcpclt_t *pTCPClt; /* our tcpclt object */
gss_ctx_id_t gss_context;
OM_uint32 gss_flags;
@@ -174,8 +161,6 @@ CODESTARTdbgPrintInstInfo
ENDdbgPrintInstInfo
-/* CODE FOR SENDING TCP MESSAGES */
-
/* This function is called immediately before a send retry is attempted.
* It shall clean up whatever makes sense.
* rgerhards, 2007-12-28
@@ -207,9 +192,7 @@ static rsRetVal TCPSendGSSInit(void *pvData)
base = (gss_base_service_name == NULL) ? "host" : gss_base_service_name;
out_tok.length = strlen(pData->f_hname) + strlen(base) + 2;
- if ((out_tok.value = malloc(out_tok.length)) == NULL) {
- ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
- }
+ CHKmalloc(out_tok.value = malloc(out_tok.length));
strcpy(out_tok.value, base);
strcat(out_tok.value, "@");
strcat(out_tok.value, pData->f_hname);
@@ -285,7 +268,7 @@ finalize_it:
RETiRet;
fail:
- errmsg.LogError(NO_ERRCODE, "GSS-API Context initialization failed\n");
+ errmsg.LogError(0, RS_RET_GSS_SENDINIT_ERROR, "GSS-API Context initialization failed\n");
gss_release_name(&min_stat, &target_name);
gss_release_buffer(&min_stat, &out_tok);
if (*context != GSS_C_NO_CONTEXT) {
@@ -365,13 +348,12 @@ static rsRetVal doTryResume(instanceData *pData)
* a common function.
*/
hints.ai_flags = AI_NUMERICSERV;
- hints.ai_family = family;
+ hints.ai_family = glbl.GetDefPFFamily();
hints.ai_socktype = SOCK_STREAM;
if((e = getaddrinfo(pData->f_hname,
getFwdSyslogPt(pData), &hints, &res)) == 0) {
dbgprintf("%s found, resuming.\n", pData->f_hname);
pData->f_addr = res;
- pData->iRtryCnt = 0;
pData->eDestState = eDestFORW;
} else {
iRet = RS_RET_SUSPENDED;
@@ -410,7 +392,6 @@ CODESTARTdoAction
case eDestFORW:
dbgprintf(" %s:%s/%s\n", pData->f_hname, getFwdSyslogPt(pData), "tcp-gssapi");
- pData->ttSuspend = time(NULL);
psz = (char*) ppString[0];
l = strlen((char*) psz);
if (l > MAXLINE)
@@ -520,12 +501,12 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
++p; /* eat */
pData->compressionLevel = iLevel;
} else {
- errmsg.LogError(NO_ERRCODE, "Invalid compression level '%c' specified in "
+ errmsg.LogError(0, NO_ERRCODE, "Invalid compression level '%c' specified in "
"forwardig action - NOT turning on compression.",
*p);
}
# else
- errmsg.LogError(NO_ERRCODE, "Compression requested, but rsyslogd is not compiled "
+ errmsg.LogError(0, NO_ERRCODE, "Compression requested, but rsyslogd is not compiled "
"with compression support - request ignored.");
# endif /* #ifdef USE_NETZIP */
} else if(*p == 'o') { /* octet-couting based TCP framing? */
@@ -533,7 +514,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* no further options settable */
tcp_framing = TCP_FRAMING_OCTET_COUNTING;
} else { /* invalid option! Just skip it... */
- errmsg.LogError(NO_ERRCODE, "Invalid option %c in forwarding action - ignoring.", *p);
+ errmsg.LogError(0, NO_ERRCODE, "Invalid option %c in forwarding action - ignoring.", *p);
++p; /* eat invalid option */
}
/* the option processing is done. We now do a generic skip
@@ -549,7 +530,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* we probably have end of string - leave it for the rest
* of the code to handle it (but warn the user)
*/
- errmsg.LogError(NO_ERRCODE, "Option block not terminated in gssapi forward action.");
+ errmsg.LogError(0, NO_ERRCODE, "Option block not terminated in gssapi forward action.");
}
/* extract the host first (we do a trick - we replace the ';' or ':' with a '\0')
* now skip to port and then template name. rgerhards 2005-07-06
@@ -567,7 +548,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* SKIP AND COUNT */;
pData->port = malloc(i + 1);
if(pData->port == NULL) {
- errmsg.LogError(NO_ERRCODE, "Could not get memory to store syslog forwarding port, "
+ errmsg.LogError(0, NO_ERRCODE, "Could not get memory to store syslog forwarding port, "
"using default port, results may not be what you intend\n");
/* we leave f_forw.port set to NULL, this is then handled by
* getFwdSyslogPt().
@@ -581,8 +562,17 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* now skip to template */
bErr = 0;
- while(*p && *p != ';' && *p != '#' && !isspace((int) *p))
- ++p; /*JUST SKIP*/
+ while(*p && *p != ';') {
+ if(*p && *p != ';' && !isspace((int) *p)) {
+ if(bErr == 0) { /* only 1 error msg! */
+ bErr = 1;
+ errno = 0;
+ errmsg.LogError(0, NO_ERRCODE, "invalid selector line (port), probably not doing "
+ "what was intended");
+ }
+ }
+ ++p;
+ }
/* TODO: make this if go away! */
if(*p == ';' || *p == '#' || isspace(*p)) {
@@ -602,12 +592,10 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
memset(&hints, 0, sizeof(hints));
/* port must be numeric, because config file syntax requests this */
hints.ai_flags = AI_NUMERICSERV;
- hints.ai_family = family;
+ hints.ai_family = glbl.GetDefPFFamily();
hints.ai_socktype = SOCK_STREAM;
if( (error = getaddrinfo(pData->f_hname, getFwdSyslogPt(pData), &hints, &res)) != 0) {
pData->eDestState = eDestFORW_UNKN;
- pData->iRtryCnt = INET_RETRY_MAX;
- pData->ttSuspend = time(NULL);
} else {
pData->eDestState = eDestFORW;
pData->f_addr = res;
@@ -630,6 +618,7 @@ ENDparseSelectorAct
BEGINmodExit
CODESTARTmodExit
+ objRelease(glbl, CORE_COMPONENT);
objRelease(errmsg, CORE_COMPONENT);
objRelease(gssutil, LM_GSSUTIL_FILENAME);
objRelease(tcpclt, LM_TCPCLT_FILENAME);
@@ -659,7 +648,7 @@ static rsRetVal setGSSMode(void __attribute__((unused)) *pVal, uchar *mode)
gss_mode = GSSMODE_ENC;
dbgprintf("GSS-API gssmode set to GSSMODE_ENC\n");
} else {
- errmsg.LogError(NO_ERRCODE, "unknown gssmode parameter: %s", (char *) mode);
+ errmsg.LogError(0, RS_RET_INVALID_PARAMS, "unknown gssmode parameter: %s", (char *) mode);
iRet = RS_RET_INVALID_PARAMS;
}
free(mode);
@@ -688,6 +677,7 @@ CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
CHKiRet(objUse(gssutil, LM_GSSUTIL_FILENAME));
CHKiRet(objUse(tcpclt, LM_TCPCLT_FILENAME));
diff --git a/plugins/omlibdbi/.cvsignore b/plugins/omlibdbi/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/omlibdbi/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/omlibdbi/Makefile.am b/plugins/omlibdbi/Makefile.am
index 872fc67c..d224f9e4 100644
--- a/plugins/omlibdbi/Makefile.am
+++ b/plugins/omlibdbi/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = omlibdbi.la
omlibdbi_la_SOURCES = omlibdbi.c
-omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(libdbi_cflags) $(pthreads_cflags)
+omlibdbi_la_CPPFLAGS = -I$(top_srcdir) $(libdbi_cflags) $(pthreads_cflags) $(rsrt_cflags)
omlibdbi_la_LDFLAGS = -module -avoid-version
omlibdbi_la_LIBADD = $(libdbi_libs)
diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c
index a942a453..6f130f54 100644
--- a/plugins/omlibdbi/omlibdbi.c
+++ b/plugins/omlibdbi/omlibdbi.c
@@ -40,7 +40,7 @@
#include <errno.h>
#include <time.h>
#include <dbi/dbi.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "syslogd-types.h"
#include "cfsysline.h"
#include "srUtils.h"
@@ -133,7 +133,7 @@ reportDBError(instanceData *pData, int bSilent)
/* output log message */
errno = 0;
if(pData->conn == NULL) {
- errmsg.LogError(NO_ERRCODE, "unknown DB error occured - could not obtain connection handle");
+ errmsg.LogError(0, NO_ERRCODE, "unknown DB error occured - could not obtain connection handle");
} else { /* we can ask dbi for the error description... */
uDBErrno = dbi_conn_error(pData->conn, &pszDbiErr);
snprintf(errMsg, sizeof(errMsg)/sizeof(char), "db error (%d): %s\n", uDBErrno, pszDbiErr);
@@ -141,7 +141,7 @@ reportDBError(instanceData *pData, int bSilent)
dbgprintf("libdbi, DBError(silent): %s\n", errMsg);
else {
pData->uLastDBErrno = uDBErrno;
- errmsg.LogError(NO_ERRCODE, "%s", errMsg);
+ errmsg.LogError(0, NO_ERRCODE, "%s", errMsg);
}
}
@@ -167,10 +167,10 @@ static rsRetVal initConn(instanceData *pData, int bSilent)
iDrvrsLoaded = dbi_initialize((char*) dbiDrvrDir);
# endif
if(iDrvrsLoaded == 0) {
- errmsg.LogError(NO_ERRCODE, "libdbi error: libdbi or libdbi drivers not present on this system - suspending.");
+ errmsg.LogError(0, RS_RET_SUSPENDED, "libdbi error: libdbi or libdbi drivers not present on this system - suspending.");
ABORT_FINALIZE(RS_RET_SUSPENDED);
} else if(iDrvrsLoaded < 0) {
- errmsg.LogError(NO_ERRCODE, "libdbi error: libdbi could not be initialized - suspending.");
+ errmsg.LogError(0, RS_RET_SUSPENDED, "libdbi error: libdbi could not be initialized - suspending.");
ABORT_FINALIZE(RS_RET_SUSPENDED);
}
bDbiInitialized = 1; /* we are done for the rest of our existence... */
@@ -182,7 +182,7 @@ static rsRetVal initConn(instanceData *pData, int bSilent)
pData->conn = dbi_conn_new((char*)pData->drvrName);
# endif
if(pData->conn == NULL) {
- errmsg.LogError(NO_ERRCODE, "can not initialize libdbi connection");
+ errmsg.LogError(0, RS_RET_SUSPENDED, "can not initialize libdbi connection");
iRet = RS_RET_SUSPENDED;
} else { /* we could get the handle, now on with work... */
/* Connect to database */
@@ -272,7 +272,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* no create the instance based on what we currently have */
if(drvrName == NULL) {
- errmsg.LogError(NO_ERRCODE, "omlibdbi: no db driver name given - action can not be created");
+ errmsg.LogError(0, RS_RET_NO_DRIVERNAME, "omlibdbi: no db driver name given - action can not be created");
ABORT_FINALIZE(RS_RET_NO_DRIVERNAME);
}
diff --git a/plugins/ommail/Makefile.am b/plugins/ommail/Makefile.am
index 7e9f5f13..fa470a43 100644
--- a/plugins/ommail/Makefile.am
+++ b/plugins/ommail/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = ommail.la
ommail_la_SOURCES = ommail.c
-ommail_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+ommail_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
ommail_la_LDFLAGS = -module -avoid-version
ommail_la_LIBADD =
diff --git a/plugins/ommail/ommail.c b/plugins/ommail/ommail.c
index 218c73c9..4bbb844a 100644
--- a/plugins/ommail/ommail.c
+++ b/plugins/ommail/ommail.c
@@ -44,12 +44,13 @@
#include <netdb.h>
#include <time.h>
#include <sys/socket.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "syslogd-types.h"
#include "srUtils.h"
#include "cfsysline.h"
#include "module-template.h"
#include "errmsg.h"
+#include "glbl.h"
MODULE_TYPE_OUTPUT
@@ -57,6 +58,7 @@ MODULE_TYPE_OUTPUT
*/
DEF_OMOD_STATIC_DATA
DEFobjCurrIf(errmsg)
+DEFobjCurrIf(glbl)
static uchar *pszSrv = NULL;
static uchar *pszSrvPort = NULL;
@@ -415,7 +417,7 @@ sendSMTP(instanceData *pData, uchar *body, uchar *subject)
CHKiRet(readResponse(pData, &iState, 220));
CHKiRet(Send(pData->md.smtp.sock, "HELO ", 5));
- CHKiRet(Send(pData->md.smtp.sock, (char*)LocalHostName, strlen((char*)LocalHostName)));
+ CHKiRet(Send(pData->md.smtp.sock, (char*)glbl.GetLocalHostName(), strlen((char*)glbl.GetLocalHostName())));
CHKiRet(Send(pData->md.smtp.sock, "\r\n", sizeof("\r\n") - 1));
CHKiRet(readResponse(pData, &iState, 250));
@@ -526,11 +528,11 @@ CODESTARTparseSelectorAct
/* TODO: check strdup() result */
if(pszFrom == NULL) {
- errmsg.LogError(NO_ERRCODE, "no sender address given - specify $ActionMailFrom");
+ errmsg.LogError(0, RS_RET_MAIL_NO_FROM, "no sender address given - specify $ActionMailFrom");
ABORT_FINALIZE(RS_RET_MAIL_NO_FROM);
}
if(pszTo == NULL) {
- errmsg.LogError(NO_ERRCODE, "no recipient address given - specify $ActionMailTo");
+ errmsg.LogError(0, RS_RET_MAIL_NO_TO, "no recipient address given - specify $ActionMailTo");
ABORT_FINALIZE(RS_RET_MAIL_NO_TO);
}
@@ -589,6 +591,7 @@ CODESTARTmodExit
freeConfigVariables();
/* release what we no longer need */
+ objRelease(glbl, CORE_COMPONENT);
objRelease(errmsg, CORE_COMPONENT);
ENDmodExit
@@ -616,6 +619,7 @@ CODESTARTmodInit
CODEmodInit_QueryRegCFSLineHdlr
/* tell which objects we need */
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailsmtpserver", 0, eCmdHdlrGetWord, NULL, &pszSrv, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailsmtpport", 0, eCmdHdlrGetWord, NULL, &pszSrvPort, STD_LOADABLE_MODULE_ID));
diff --git a/plugins/ommysql/.cvsignore b/plugins/ommysql/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/ommysql/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/ommysql/Makefile.am b/plugins/ommysql/Makefile.am
index 3b4e6d75..d5433a40 100644
--- a/plugins/ommysql/Makefile.am
+++ b/plugins/ommysql/Makefile.am
@@ -1,7 +1,7 @@
pkglib_LTLIBRARIES = ommysql.la
ommysql_la_SOURCES = ommysql.c ommysql.h
-ommysql_la_CPPFLAGS = -I$(top_srcdir) $(mysql_cflags) $(pthreads_cflags)
+ommysql_la_CPPFLAGS = $(rsrt_cflags) $(mysql_cflags) $(pthreads_cflags)
ommysql_la_LDFLAGS = -module -avoid-version
ommysql_la_LIBADD = $(mysql_libs)
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index 0522e31d..e69ab40b 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -37,7 +37,7 @@
#include <time.h>
#include <mysql/mysql.h>
#include <mysql/errmsg.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "syslogd-types.h"
#include "srUtils.h"
#include "template.h"
@@ -115,7 +115,7 @@ static void reportDBError(instanceData *pData, int bSilent)
/* output log message */
errno = 0;
if(pData->f_hmysql == NULL) {
- errmsg.LogError(NO_ERRCODE, "unknown DB error occured - could not obtain MySQL handle");
+ errmsg.LogError(0, NO_ERRCODE, "unknown DB error occured - could not obtain MySQL handle");
} else { /* we can ask mysql for the error description... */
uMySQLErrno = mysql_errno(pData->f_hmysql);
snprintf(errMsg, sizeof(errMsg)/sizeof(char), "db error (%d): %s\n", uMySQLErrno,
@@ -124,7 +124,7 @@ static void reportDBError(instanceData *pData, int bSilent)
dbgprintf("mysql, DBError(silent): %s\n", errMsg);
else {
pData->uLastMySQLErrno = uMySQLErrno;
- errmsg.LogError(NO_ERRCODE, "%s", errMsg);
+ errmsg.LogError(0, NO_ERRCODE, "%s", errMsg);
}
}
@@ -145,7 +145,7 @@ static rsRetVal initMySQL(instanceData *pData, int bSilent)
pData->f_hmysql = mysql_init(NULL);
if(pData->f_hmysql == NULL) {
- errmsg.LogError(NO_ERRCODE, "can not initialize MySQL handle");
+ errmsg.LogError(0, RS_RET_SUSPENDED, "can not initialize MySQL handle");
iRet = RS_RET_SUSPENDED;
} else { /* we could get the handle, now on with work... */
/* Connect to database */
@@ -270,7 +270,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
* Retries make no sense.
*/
if (iMySQLPropErr) {
- errmsg.LogError(NO_ERRCODE, "Trouble with MySQL connection properties. -MySQL logging disabled");
+ errmsg.LogError(0, RS_RET_INVALID_PARAMS, "Trouble with MySQL connection properties. -MySQL logging disabled");
ABORT_FINALIZE(RS_RET_INVALID_PARAMS);
} else {
pData->f_hmysql = NULL; /* initialize, but connect only on first message (important for queued mode!) */
diff --git a/plugins/ompgsql/.cvsignore b/plugins/ompgsql/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/ompgsql/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/ompgsql/Makefile.am b/plugins/ompgsql/Makefile.am
index b2e3effa..cc1c5f49 100644
--- a/plugins/ompgsql/Makefile.am
+++ b/plugins/ompgsql/Makefile.am
@@ -1,7 +1,7 @@
pkglib_LTLIBRARIES = ompgsql.la
ompgsql_la_SOURCES = ompgsql.c ompgsql.h
-ompgsql_la_CPPFLAGS = -I$(top_srcdir) $(pgsql_cflags)
+ompgsql_la_CPPFLAGS = -I$(top_srcdir) $(pgsql_cflags) $(rsrt_cflags)
ompgsql_la_LDFLAGS = -module -avoid-version
ompgsql_la_LIBADD = $(pgsql_libs)
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c
index 1d7b2eb7..f8685672 100644
--- a/plugins/ompgsql/ompgsql.c
+++ b/plugins/ompgsql/ompgsql.c
@@ -36,7 +36,7 @@
#include <errno.h>
#include <time.h>
#include <libpq-fe.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "syslogd-types.h"
#include "srUtils.h"
#include "template.h"
@@ -113,7 +113,7 @@ static void reportDBError(instanceData *pData, int bSilent)
/* output log message */
errno = 0;
if(pData->f_hpgsql == NULL) {
- errmsg.LogError(NO_ERRCODE, "unknown DB error occured - could not obtain PgSQL handle");
+ errmsg.LogError(0, NO_ERRCODE, "unknown DB error occured - could not obtain PgSQL handle");
} else { /* we can ask pgsql for the error description... */
ePgSQLStatus = PQstatus(pData->f_hpgsql);
snprintf(errMsg, sizeof(errMsg)/sizeof(char), "db error (%d): %s\n", ePgSQLStatus,
@@ -122,7 +122,7 @@ static void reportDBError(instanceData *pData, int bSilent)
dbgprintf("pgsql, DBError(silent): %s\n", errMsg);
else {
pData->eLastPgSQLStatus = ePgSQLStatus;
- errmsg.LogError(NO_ERRCODE, "%s", errMsg);
+ errmsg.LogError(0, NO_ERRCODE, "%s", errMsg);
}
}
@@ -264,7 +264,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
* Retries make no sense.
*/
if (iPgSQLPropErr) {
- errmsg.LogError(NO_ERRCODE, "Trouble with PgSQL connection properties. -PgSQL logging disabled");
+ errmsg.LogError(0, RS_RET_INVALID_PARAMS, "Trouble with PgSQL connection properties. -PgSQL logging disabled");
ABORT_FINALIZE(RS_RET_INVALID_PARAMS);
} else {
CHKiRet(initPgSQL(pData, 0));
diff --git a/plugins/omrelp/.cvsignore b/plugins/omrelp/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/omrelp/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/omrelp/Makefile.am b/plugins/omrelp/Makefile.am
index dfc2111f..f8384f42 100644
--- a/plugins/omrelp/Makefile.am
+++ b/plugins/omrelp/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = omrelp.la
omrelp_la_SOURCES = omrelp.c
-omrelp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(RELP_CFLAGS)
+omrelp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(RELP_CFLAGS) $(rsrt_cflags)
omrelp_la_LDFLAGS = -module -avoid-version
omrelp_la_LIBADD = $(RELP_LIBS)
diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c
index 04571682..71d6e797 100644
--- a/plugins/omrelp/omrelp.c
+++ b/plugins/omrelp/omrelp.c
@@ -36,11 +36,12 @@
#include <errno.h>
#include <ctype.h>
#include <librelp.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "syslogd-types.h"
#include "srUtils.h"
#include "cfsysline.h"
#include "module-template.h"
+#include "glbl.h"
#include "errmsg.h"
MODULE_TYPE_OUTPUT
@@ -49,6 +50,7 @@ MODULE_TYPE_OUTPUT
*/
DEF_OMOD_STATIC_DATA
DEFobjCurrIf(errmsg)
+DEFobjCurrIf(glbl)
static relpEngine_t *pRelpEngine; /* our relp engine */
@@ -118,7 +120,7 @@ static rsRetVal doConnect(instanceData *pData)
DEFiRet;
if(pData->bInitialConnect) {
- iRet = relpCltConnect(pData->pRelpClt, family, (uchar*) pData->port, (uchar*) pData->f_hname);
+ iRet = relpCltConnect(pData->pRelpClt, glbl.GetDefPFFamily(), (uchar*) pData->port, (uchar*) pData->f_hname);
if(iRet == RELP_RET_OK)
pData->bInitialConnect = 0;
} else {
@@ -162,7 +164,6 @@ CODESTARTdoAction
/* forward */
ret = relpCltSendSyslog(pData->pRelpClt, (uchar*) pMsg, lenMsg);
-RUNLOG_VAR("%d", ret);
if(ret != RELP_RET_OK) {
/* error! */
dbgprintf("error forwarding via relp, suspending\n");
@@ -218,16 +219,16 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
++p; /* eat */
pData->compressionLevel = iLevel;
} else {
- errmsg.LogError(NO_ERRCODE, "Invalid compression level '%c' specified in "
+ errmsg.LogError(0, NO_ERRCODE, "Invalid compression level '%c' specified in "
"forwardig action - NOT turning on compression.",
*p);
}
# else
- errmsg.LogError(NO_ERRCODE, "Compression requested, but rsyslogd is not compiled "
+ errmsg.LogError(0, NO_ERRCODE, "Compression requested, but rsyslogd is not compiled "
"with compression support - request ignored.");
# endif /* #ifdef USE_NETZIP */
} else { /* invalid option! Just skip it... */
- errmsg.LogError(NO_ERRCODE, "Invalid option %c in forwarding action - ignoring.", *p);
+ errmsg.LogError(0, NO_ERRCODE, "Invalid option %c in forwarding action - ignoring.", *p);
++p; /* eat invalid option */
}
/* the option processing is done. We now do a generic skip
@@ -243,7 +244,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* we probably have end of string - leave it for the rest
* of the code to handle it (but warn the user)
*/
- errmsg.LogError(NO_ERRCODE, "Option block not terminated in forwarding action.");
+ errmsg.LogError(0, NO_ERRCODE, "Option block not terminated in forwarding action.");
}
/* extract the host first (we do a trick - we replace the ';' or ':' with a '\0')
* now skip to port and then template name. rgerhards 2005-07-06
@@ -261,7 +262,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* SKIP AND COUNT */;
pData->port = malloc(i + 1);
if(pData->port == NULL) {
- errmsg.LogError(NO_ERRCODE, "Could not get memory to store relp port, "
+ errmsg.LogError(0, NO_ERRCODE, "Could not get memory to store relp port, "
"using default port, results may not be what you intend\n");
/* we leave f_forw.port set to NULL, this is then handled by getRelpPt() */
} else {
@@ -277,7 +278,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
if(bErr == 0) { /* only 1 error msg! */
bErr = 1;
errno = 0;
- errmsg.LogError(NO_ERRCODE, "invalid selector line (port), probably not doing "
+ errmsg.LogError(0, NO_ERRCODE, "invalid selector line (port), probably not doing "
"what was intended");
}
}
@@ -311,6 +312,7 @@ CODESTARTmodExit
relpEngineDestruct(&pRelpEngine);
/* release what we no longer need */
+ objRelease(glbl, CORE_COMPONENT);
objRelease(errmsg, CORE_COMPONENT);
ENDmodExit
@@ -332,6 +334,7 @@ CODEmodInit_QueryRegCFSLineHdlr
/* tell which objects we need */
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
ENDmodInit
/* vim:set ai:
diff --git a/plugins/omsnmp/.cvsignore b/plugins/omsnmp/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/omsnmp/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/omsnmp/Makefile.am b/plugins/omsnmp/Makefile.am
index d74f7bb4..d784faca 100644
--- a/plugins/omsnmp/Makefile.am
+++ b/plugins/omsnmp/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = omsnmp.la
omsnmp_la_SOURCES = omsnmp.c omsnmp.h
-omsnmp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+omsnmp_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
omsnmp_la_LDFLAGS = -module -avoid-version
omsnmp_la_LIBADD = $(snmp_libs)
diff --git a/plugins/omsnmp/omsnmp.c b/plugins/omsnmp/omsnmp.c
index 22d48340..72fa8d64 100644
--- a/plugins/omsnmp/omsnmp.c
+++ b/plugins/omsnmp/omsnmp.c
@@ -36,7 +36,7 @@
#include <netdb.h>
#include <ctype.h>
#include <assert.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "syslogd-types.h"
#include "cfsysline.h"
#include "module-template.h"
@@ -179,7 +179,7 @@ static rsRetVal omsnmp_initSession(instanceData *pData)
pData->snmpsession = snmp_open(&session);
if (pData->snmpsession == NULL) {
- errmsg.LogError(NO_ERRCODE, "omsnmp_initSession: snmp_open to host '%s' on Port '%d' failed\n", pData->szTarget, pData->iPort);
+ errmsg.LogError(0, RS_RET_SUSPENDED, "omsnmp_initSession: snmp_open to host '%s' on Port '%d' failed\n", pData->szTarget, pData->iPort);
/* Stay suspended */
iRet = RS_RET_SUSPENDED;
}
@@ -218,7 +218,7 @@ static rsRetVal omsnmp_sendsnmp(instanceData *pData, uchar *psz)
if (!snmp_parse_oid( (char*) pData->szEnterpriseOID, enterpriseoid, &enterpriseoidlen ))
{
strErr = snmp_api_errstring(snmp_errno);
- errmsg.LogError(NO_ERRCODE, "omsnmp_sendsnmp: Parsing EnterpriseOID failed '%s' with error '%s' \n", pData->szSyslogMessageOID, strErr);
+ errmsg.LogError(0, RS_RET_DISABLE_ACTION, "omsnmp_sendsnmp: Parsing EnterpriseOID failed '%s' with error '%s' \n", pData->szSyslogMessageOID, strErr);
ABORT_FINALIZE(RS_RET_DISABLE_ACTION);
}
@@ -254,7 +254,7 @@ static rsRetVal omsnmp_sendsnmp(instanceData *pData, uchar *psz)
if ( snmp_add_var(pdu, objid_snmptrap, sizeof(objid_snmptrap) / sizeof(oid), 'o', (char*) pData->szSnmpTrapOID ) != 0)
{
strErr = snmp_api_errstring(snmp_errno);
- errmsg.LogError(NO_ERRCODE, "omsnmp_sendsnmp: Adding trap OID failed '%s' with error '%s' \n", pData->szSnmpTrapOID, strErr);
+ errmsg.LogError(0, RS_RET_DISABLE_ACTION, "omsnmp_sendsnmp: Adding trap OID failed '%s' with error '%s' \n", pData->szSnmpTrapOID, strErr);
ABORT_FINALIZE(RS_RET_DISABLE_ACTION);
}
}
@@ -269,14 +269,14 @@ static rsRetVal omsnmp_sendsnmp(instanceData *pData, uchar *psz)
if (iErrCode)
{
const char *str = snmp_api_errstring(iErrCode);
- errmsg.LogError(NO_ERRCODE, "omsnmp_sendsnmp: Invalid SyslogMessage OID, error code '%d' - '%s'\n", iErrCode, str );
+ errmsg.LogError(0, RS_RET_DISABLE_ACTION, "omsnmp_sendsnmp: Invalid SyslogMessage OID, error code '%d' - '%s'\n", iErrCode, str );
ABORT_FINALIZE(RS_RET_DISABLE_ACTION);
}
}
else
{
strErr = snmp_api_errstring(snmp_errno);
- errmsg.LogError(NO_ERRCODE, "omsnmp_sendsnmp: Parsing SyslogMessageOID failed '%s' with error '%s' \n", pData->szSyslogMessageOID, strErr);
+ errmsg.LogError(0, RS_RET_DISABLE_ACTION, "omsnmp_sendsnmp: Parsing SyslogMessageOID failed '%s' with error '%s' \n", pData->szSyslogMessageOID, strErr);
ABORT_FINALIZE(RS_RET_DISABLE_ACTION);
}
@@ -287,7 +287,7 @@ static rsRetVal omsnmp_sendsnmp(instanceData *pData, uchar *psz)
{
/* Debug Output! */
int iErrorCode = pData->snmpsession->s_snmp_errno;
- errmsg.LogError(NO_ERRCODE, "omsnmp_sendsnmp: snmp_send failed error '%d', Description='%s'\n", iErrorCode*(-1), api_errors[iErrorCode*(-1)]);
+ errmsg.LogError(0, RS_RET_SUSPENDED, "omsnmp_sendsnmp: snmp_send failed error '%d', Description='%s'\n", iErrorCode*(-1), api_errors[iErrorCode*(-1)]);
/* Clear Session */
omsnmp_exitSession(pData);
diff --git a/plugins/omtesting/.cvsignore b/plugins/omtesting/.cvsignore
deleted file mode 100644
index 9730646f..00000000
--- a/plugins/omtesting/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
diff --git a/plugins/omtesting/Makefile.am b/plugins/omtesting/Makefile.am
index 7e376683..8e98ca63 100644
--- a/plugins/omtesting/Makefile.am
+++ b/plugins/omtesting/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = omtesting.la
omtesting_la_SOURCES = omtesting.c
-omtesting_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags)
+omtesting_la_CPPFLAGS = -I$(top_srcdir) $(pthreads_cflags) $(rsrt_cflags)
omtesting_la_LDFLAGS = -module -avoid-version
omtesting_la_LIBADD =
diff --git a/plugins/omtesting/omtesting.c b/plugins/omtesting/omtesting.c
index 15d3cb80..411bcf88 100644
--- a/plugins/omtesting/omtesting.c
+++ b/plugins/omtesting/omtesting.c
@@ -49,7 +49,7 @@
#include <string.h>
#include <ctype.h>
#include <assert.h>
-#include "syslogd.h"
+#include "dirty.h"
#include "syslogd-types.h"
#include "module-template.h"