summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-07 08:06:16 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-07 08:06:16 +0000
commitfa67273c1644551b50919fa7879acfdc92e269bc (patch)
tree38e41ee526a4bcc19540047c56c93b2a7865ef36 /plugins
parentae3e3e9cb1584b5cf7082c1b28c4cbbd48b1f664 (diff)
downloadrsyslog-fa67273c1644551b50919fa7879acfdc92e269bc.tar.gz
rsyslog-fa67273c1644551b50919fa7879acfdc92e269bc.tar.xz
rsyslog-fa67273c1644551b50919fa7879acfdc92e269bc.zip
- added RSYSLOGD_MODDIR environment variable
- added -M rsyslogd option (allows to specify module directory location) - converted net.c into a loadable library plugin
Diffstat (limited to 'plugins')
-rw-r--r--plugins/imgssapi/imgssapi.c22
-rw-r--r--plugins/imtcp/imtcp.c12
-rw-r--r--plugins/imudp/imudp.c23
3 files changed, 32 insertions, 25 deletions
diff --git a/plugins/imgssapi/imgssapi.c b/plugins/imgssapi/imgssapi.c
index 1c0dd79a..4a7479f4 100644
--- a/plugins/imgssapi/imgssapi.c
+++ b/plugins/imgssapi/imgssapi.c
@@ -77,6 +77,7 @@ DEFobjCurrIf(tcpsrv)
DEFobjCurrIf(tcps_sess)
DEFobjCurrIf(gssutil)
DEFobjCurrIf(errmsg)
+DEFobjCurrIf(net)
static tcpsrv_t *pOurTcpsrv = NULL; /* our TCP server(listener) TODO: change for multiple instances */
static gss_cred_id_t gss_server_creds = GSS_C_NO_CREDENTIAL;
@@ -171,10 +172,10 @@ isPermittedHost(struct sockaddr *addr, char *fromHostFQDN, void *pUsrSrv, void*p
pGSess = (gss_sess_t*) pUsrSess;
if((pGSrv->allowedMethods & ALLOWEDMETHOD_TCP) &&
- isAllowedSender(pAllowedSenders_TCP, addr, (char*)fromHostFQDN))
+ isAllowedSender(net.pAllowedSenders_TCP, addr, (char*)fromHostFQDN))
allowedMethods |= ALLOWEDMETHOD_TCP;
if((pGSrv->allowedMethods & ALLOWEDMETHOD_GSS) &&
- isAllowedSender(pAllowedSenders_GSS, addr, (char*)fromHostFQDN))
+ isAllowedSender(net.pAllowedSenders_GSS, addr, (char*)fromHostFQDN))
allowedMethods |= ALLOWEDMETHOD_GSS;
if(allowedMethods && pGSess != NULL)
pGSess->allowedMethods = allowedMethods;
@@ -636,8 +637,8 @@ CODESTARTwillRun
if(pOurTcpsrv == NULL)
ABORT_FINALIZE(RS_RET_NO_RUN);
- PrintAllowedSenders(2); /* TCP */
- PrintAllowedSenders(3); /* GSS */
+ net.PrintAllowedSenders(2); /* TCP */
+ net.PrintAllowedSenders(3); /* GSS */
finalize_it:
ENDwillRun
@@ -654,13 +655,13 @@ ENDmodExit
BEGINafterRun
CODESTARTafterRun
/* do cleanup here */
- if (pAllowedSenders_TCP != NULL) {
- clearAllowedSenders (pAllowedSenders_TCP);
- pAllowedSenders_TCP = NULL;
+ if (net.pAllowedSenders_TCP != NULL) {
+ net.clearAllowedSenders (net.pAllowedSenders_TCP);
+ net.pAllowedSenders_TCP = NULL;
}
- if (pAllowedSenders_GSS != NULL) {
- clearAllowedSenders (pAllowedSenders_GSS);
- pAllowedSenders_GSS = NULL;
+ if (net.pAllowedSenders_GSS != NULL) {
+ net.clearAllowedSenders (net.pAllowedSenders_GSS);
+ net.pAllowedSenders_GSS = NULL;
}
ENDafterRun
@@ -693,6 +694,7 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(tcpsrv, "tcpsrv"));
CHKiRet(objUse(gssutil, "gssutil"));
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(net, "net"));
/* register config file handlers */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputgssserverpermitplaintcp", 0, eCmdHdlrBinary,
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index ca52d3c5..2da094a4 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -51,6 +51,7 @@ MODULE_TYPE_INPUT
DEF_IMOD_STATIC_DATA
DEFobjCurrIf(tcpsrv)
DEFobjCurrIf(tcps_sess)
+DEFobjCurrIf(net)
/* Module static data */
static tcpsrv_t *pOurTcpsrv = NULL; /* our TCP server(listener) TODO: change for multiple instances */
@@ -65,7 +66,7 @@ static int
isPermittedHost(struct sockaddr *addr, char *fromHostFQDN, void __attribute__((unused)) *pUsrSrv,
void __attribute__((unused)) *pUsrSess)
{
- return isAllowedSender(pAllowedSenders_TCP, addr, fromHostFQDN);
+ return isAllowedSender(net.pAllowedSenders_TCP, addr, fromHostFQDN);
}
@@ -159,7 +160,7 @@ ENDrunInput
BEGINwillRun
CODESTARTwillRun
/* first apply some config settings */
- PrintAllowedSenders(2); /* TCP */
+ net.PrintAllowedSenders(2); /* TCP */
if(pOurTcpsrv == NULL)
ABORT_FINALIZE(RS_RET_NO_RUN);
finalize_it:
@@ -169,9 +170,9 @@ ENDwillRun
BEGINafterRun
CODESTARTafterRun
/* do cleanup here */
- if (pAllowedSenders_TCP != NULL) {
- clearAllowedSenders (pAllowedSenders_TCP);
- pAllowedSenders_TCP = NULL;
+ if(net.pAllowedSenders_TCP != NULL) {
+ net.clearAllowedSenders(net.pAllowedSenders_TCP);
+ net.pAllowedSenders_TCP = NULL;
}
ENDafterRun
@@ -204,6 +205,7 @@ CODESTARTmodInit
CODEmodInit_QueryRegCFSLineHdlr
pOurTcpsrv = NULL;
/* request objects we use */
+ CHKiRet(objUse(net, "net"));
CHKiRet(objUse(tcps_sess, "tcpsrv"));
CHKiRet(objUse(tcpsrv, "tcpsrv"));
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index be9fb6cc..f18461e7 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -47,6 +47,8 @@ MODULE_TYPE_INPUT
/* Module static data */
DEF_IMOD_STATIC_DATA
DEFobjCurrIf(errmsg)
+DEFobjCurrIf(net)
+
static int *udpLstnSocks = NULL; /* Internet datagram sockets, first element is nbr of elements
* read-only after init(), but beware of restart! */
static uchar *pszBindAddr = NULL; /* IP to bind socket to */
@@ -84,7 +86,7 @@ static rsRetVal addListner(void __attribute__((unused)) *pVal, uchar *pNewVal)
dbgprintf("Trying to open syslog UDP ports at %s:%s.\n",
(bindAddr == NULL) ? (uchar*)"*" : bindAddr, pNewVal);
- newSocks = create_udp_socket(bindAddr, (pNewVal == NULL || *pNewVal == '\0') ? (uchar*) "514" : pNewVal, 1);
+ newSocks = net.create_udp_socket(bindAddr, (pNewVal == NULL || *pNewVal == '\0') ? (uchar*) "514" : pNewVal, 1);
if(newSocks != NULL) {
/* we now need to add the new sockets to the existing set */
if(udpLstnSocks == NULL) {
@@ -154,7 +156,7 @@ CODESTARTrunInput
for (i = 0; i < *udpLstnSocks; i++) {
if (udpLstnSocks[i+1] != -1) {
if(Debug)
- debugListenInfo(udpLstnSocks[i+1], "UDP");
+ net.debugListenInfo(udpLstnSocks[i+1], "UDP");
FD_SET(udpLstnSocks[i+1], &readfds);
if(udpLstnSocks[i+1]>maxfds) maxfds=udpLstnSocks[i+1];
}
@@ -178,7 +180,7 @@ CODESTARTrunInput
l = recvfrom(udpLstnSocks[i+1], (char*) pRcvBuf, MAXLINE - 1, 0,
(struct sockaddr *)&frominet, &socklen);
if (l > 0) {
- if(cvthname(&frominet, fromHost, fromHostFQDN) == RS_RET_OK) {
+ if(net.cvthname(&frominet, fromHost, fromHostFQDN) == 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
@@ -187,7 +189,7 @@ CODESTARTrunInput
* configured to do this).
* rgerhards, 2005-09-26
*/
- if(isAllowedSender(pAllowedSenders_UDP,
+ if(isAllowedSender(net.pAllowedSenders_UDP,
(struct sockaddr *)&frominet, (char*)fromHostFQDN)) {
parseAndSubmitMessage((char*)fromHost, (char*) pRcvBuf, l,
MSG_PARSE_HOSTNAME, NOFLAG);
@@ -220,7 +222,7 @@ ENDrunInput
/* initialize and return if will run or not */
BEGINwillRun
CODESTARTwillRun
- PrintAllowedSenders(1); /* UDP */
+ net.PrintAllowedSenders(1); /* UDP */
/* if we could not set up any listners, there is no point in running... */
if(udpLstnSocks == NULL)
@@ -236,12 +238,12 @@ ENDwillRun
BEGINafterRun
CODESTARTafterRun
/* do cleanup here */
- if (pAllowedSenders_UDP != NULL) {
- clearAllowedSenders (pAllowedSenders_UDP);
- pAllowedSenders_UDP = NULL;
+ if (net.pAllowedSenders_UDP != NULL) {
+ net.clearAllowedSenders (net.pAllowedSenders_UDP);
+ net.pAllowedSenders_UDP = NULL;
}
if(udpLstnSocks != NULL)
- closeUDPListenSockets(udpLstnSocks);
+ net.closeUDPListenSockets(udpLstnSocks);
if(pRcvBuf != NULL)
free(pRcvBuf);
ENDafterRun
@@ -264,7 +266,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
pszBindAddr = NULL;
}
if(udpLstnSocks != NULL) {
- closeUDPListenSockets(udpLstnSocks);
+ net.closeUDPListenSockets(udpLstnSocks);
udpLstnSocks = NULL;
}
return RS_RET_OK;
@@ -276,6 +278,7 @@ CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(net, "net"));
/* register config file handlers */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"udpserverrun", 0, eCmdHdlrGetWord,