diff options
author | Michael Biebl <biebl@debian.org> | 2008-12-12 17:46:20 +0100 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2008-12-12 17:46:20 +0100 |
commit | 84080b58f8c6c5c040723a02503ddd90f02b5898 (patch) | |
tree | cf8c63e076f1ebb9cb2bea644a4f45172808a3e5 /plugins/imudp | |
parent | 53123ea8a1b9180b9aa0568e847f9245987c1b7c (diff) | |
download | rsyslog-84080b58f8c6c5c040723a02503ddd90f02b5898.tar.gz |
Imported Upstream version 3.20.2upstream/3.20.2
Diffstat (limited to 'plugins/imudp')
-rw-r--r-- | plugins/imudp/Makefile.am | 2 | ||||
-rw-r--r-- | plugins/imudp/Makefile.in | 13 | ||||
-rw-r--r-- | plugins/imudp/imudp.c | 33 |
3 files changed, 30 insertions, 18 deletions
diff --git a/plugins/imudp/Makefile.am b/plugins/imudp/Makefile.am index 53fdad1..28ee985 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/Makefile.in b/plugins/imudp/Makefile.in index a1c0107..8ee7f82 100644 --- a/plugins/imudp/Makefile.in +++ b/plugins/imudp/Makefile.in @@ -102,6 +102,7 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ +HAVE_GNUTLS_CONFIG = @HAVE_GNUTLS_CONFIG@ HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@ HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@ INSTALL = @INSTALL@ @@ -110,6 +111,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@ +LIBLOGGING_LIBS = @LIBLOGGING_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -130,6 +133,8 @@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ RELP_CFLAGS = @RELP_CFLAGS@ RELP_LIBS = @RELP_LIBS@ +RFC3195_CFLAGS = @RFC3195_CFLAGS@ +RFC3195_LIBS = @RFC3195_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -160,6 +165,8 @@ dl_libs = @dl_libs@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +gnutls_cflags = @gnutls_cflags@ +gnutls_libs = @gnutls_libs@ gss_libs = @gss_libs@ host = @host@ host_alias = @host_alias@ @@ -189,8 +196,8 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ pthreads_cflags = @pthreads_cflags@ pthreads_libs = @pthreads_libs@ -rfc3195_cflags = @rfc3195_cflags@ -rfc3195_libs = @rfc3195_libs@ +rsrt_cflags = @rsrt_cflags@ +rsrt_libs = @rsrt_libs@ rt_libs = @rt_libs@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ @@ -205,7 +212,7 @@ top_srcdir = @top_srcdir@ zlib_libs = @zlib_libs@ 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 = all: all-am diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c index 3cdd8dd..b18c0db 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 time_t ttLastDiscard = 0; /* timestamp when a message from a non-permitted sender was last discarded @@ -137,6 +139,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 @@ -184,7 +187,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 @@ -195,20 +198,20 @@ CODESTARTrunInput */ if(net.isAllowedSender((uchar*) "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) { - time_t tt; - - time(&tt); - if(tt > ttLastDiscard + 60) { - ttLastDiscard = tt; - errmsg.LogError(NO_ERRCODE, - "UDP message from disallowed sender %s discarded", - (char*)fromHost); - } + if(glbl.GetOption_DisallowWarning) { + time_t tt; + + time(&tt); + if(tt > ttLastDiscard + 60) { + ttLastDiscard = tt; + errmsg.LogError(0, NO_ERRCODE, + "UDP message from disallowed sender %s discarded", + (char*)fromHost); + } } } } @@ -216,7 +219,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); } @@ -265,6 +268,7 @@ BEGINmodExit CODESTARTmodExit /* release what we no longer need */ objRelease(errmsg, CORE_COMPONENT); + objRelease(glbl, CORE_COMPONENT); objRelease(net, LM_NET_FILENAME); ENDmodExit @@ -293,6 +297,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 */ |