summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-25 16:04:46 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-25 16:04:46 +0000
commit2c8eae6a0c00b1e067cca8a1a77b7f9ca4a9e7f3 (patch)
treedc2b3456d81c35f3b0d8946a0d3fc1091d5c3b32
parent7af2c0a66b03db92a9ca1faae6c37c8fdc666c0e (diff)
downloadrsyslog-2c8eae6a0c00b1e067cca8a1a77b7f9ca4a9e7f3.tar.gz
rsyslog-2c8eae6a0c00b1e067cca8a1a77b7f9ca4a9e7f3.tar.xz
rsyslog-2c8eae6a0c00b1e067cca8a1a77b7f9ca4a9e7f3.zip
moved some of the udp input code to its right place
-rw-r--r--modules.h2
-rw-r--r--net.c7
-rw-r--r--net.h3
-rw-r--r--plugins/imudp/imudp.c6
-rw-r--r--syslogd.c17
-rw-r--r--syslogd.h3
6 files changed, 19 insertions, 19 deletions
diff --git a/modules.h b/modules.h
index 0ff49afe..0fbc7a6b 100644
--- a/modules.h
+++ b/modules.h
@@ -78,7 +78,7 @@ typedef struct moduleInfo {
eTermSyncType_t eTermSyncType;
rsRetVal (*runInput)(thrdInfo_t*); /* function to gather input and submit to queue */
rsRetVal (*willRun)(void); /* function to gather input and submit to queue */
- rsRetVal (*afterRun)(void); /* function to gather input and submit to queue */
+ rsRetVal (*afterRun)(thrdInfo_t*); /* function to gather input and submit to queue */
} im;
struct {/* data for output modules */
/* below: perform the configured action
diff --git a/net.c b/net.c
index 94b242e3..7b52bb98 100644
--- a/net.c
+++ b/net.c
@@ -137,8 +137,12 @@ static rsRetVal AddAllowedSenderEntry(struct AllowedSenders **ppRoot, struct All
/* function to clear the allowed sender structure in cases where
* it must be freed (occurs most often when HUPed.
* TODO: reconsider recursive implementation
+ * I think there is also a memory leak, because only the last entry
+ * is acutally deleted... -- rgerhards, 2007-12-25
*/
-void clearAllowedSenders (struct AllowedSenders *pAllow) {
+void clearAllowedSenders (struct AllowedSenders *pAllow)
+{
+dbgprintf("clearAllowedSenders(0x%lx)\n", (unsigned long) pAllow);
if (pAllow != NULL) {
if (pAllow->pNext != NULL)
clearAllowedSenders (pAllow->pNext);
@@ -840,6 +844,7 @@ void closeUDPListenSockets()
{
register int i;
+dbgprintf("in closeUDPListenSockets()\n");
if(finet != NULL) {
for (i = 0; i < *finet; i++)
close(finet[i+1]);
diff --git a/net.h b/net.h
index 953110d5..cdc4d0ba 100644
--- a/net.h
+++ b/net.h
@@ -80,6 +80,9 @@ int *create_udp_socket(uchar *LogPort);
extern int ACLAddHostnameOnFail; /* add hostname to acl when DNS resolving has failed */
extern int ACLDontResolve; /* add hostname to acl instead of resolving it to IP(s) */
+extern struct AllowedSenders *pAllowedSenders_UDP;
+extern struct AllowedSenders *pAllowedSenders_TCP;
+extern struct AllowedSenders *pAllowedSenders_GSS;
#endif /* #ifdef SYSLOG_INET */
#endif /* #ifndef INCLUDED_NET_H */
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index ed18ddf1..367258ca 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -106,7 +106,6 @@ CODESTARTrunInput
for (i = 0; nfds && i < *finet; i++) {
if (FD_ISSET(finet[i+1], &readfds)) {
socklen = sizeof(frominet);
- memset(line, 0xff, sizeof(line)); // TODO: I think we need this for debug only - remove after bug hunt
l = recvfrom(finet[i+1], line, MAXLINE - 1, 0,
(struct sockaddr *)&frominet, &socklen);
if (l > 0) {
@@ -158,6 +157,11 @@ ENDwillRun
BEGINafterRun
CODESTARTafterRun
/* do cleanup here */
+dbgprintf("call clearAllowedSenders(0x%lx)\n", (unsigned long) pAllowedSenders_UDP);
+ if (pAllowedSenders_UDP != NULL) {
+ clearAllowedSenders (pAllowedSenders_UDP);
+ pAllowedSenders_UDP = NULL;
+ }
ENDafterRun
diff --git a/syslogd.c b/syslogd.c
index c2fe3521..bcc9cdaf 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -2760,7 +2760,8 @@ static void doDie(int sig)
* any calls to die() in new code!
* rgerhards, 2005-10-24
*/
-static void die(int sig)
+static void
+die(int sig)
{
char buf[256];
@@ -3475,11 +3476,6 @@ init(void)
#ifdef SYSLOG_INET
if (restart) {
- if (pAllowedSenders_UDP != NULL) {
- clearAllowedSenders (pAllowedSenders_UDP);
- pAllowedSenders_UDP = NULL;
- }
-
if (pAllowedSenders_TCP != NULL) {
clearAllowedSenders (pAllowedSenders_TCP);
pAllowedSenders_TCP = NULL;
@@ -3491,13 +3487,8 @@ init(void)
}
#endif
}
-
- assert(pAllowedSenders_UDP == NULL && pAllowedSenders_TCP == NULL
-#ifdef USE_GSSAPI
- && pAllowedSenders_GSS == NULL
-#endif
- );
#endif
+
/* I was told by an IPv6 expert that calling getservbyname() seems to be
* still valid, at least for the use case we have. So I re-enabled that
* code. rgerhards, 2007-07-02
@@ -3602,7 +3593,7 @@ init(void)
*/
if(Forwarding || AcceptRemote) {
if (finet == NULL) {
- if((finet = create_udp_socket(LogPort)) != NULL)
+ if((finet = create_udp_socket((uchar*)LogPort)) != NULL)
dbgprintf("Opened %d syslog UDP port(s).\n", *finet);
}
} else {
diff --git a/syslogd.h b/syslogd.h
index d470504d..df3629c7 100644
--- a/syslogd.h
+++ b/syslogd.h
@@ -86,9 +86,6 @@ extern int DisableDNS;
extern char **StripDomains;
extern char *LocalDomain;
extern int bDropMalPTRMsgs;
-extern struct AllowedSenders *pAllowedSenders_UDP;
-extern struct AllowedSenders *pAllowedSenders_TCP;
-extern struct AllowedSenders *pAllowedSenders_GSS;
extern char ctty[];
#endif /* #ifndef SYSLOGD_H_INCLUDED */