From e1791996b81b486e53a36ec753c3bb595f671983 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 17 Apr 2008 10:58:30 +0200 Subject: moved host/domain-name related variables to global data pool --- runtime/glbl.h | 4 ++++ runtime/net.c | 15 +++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/glbl.h b/runtime/glbl.h index 3116b66b..eb0495b2 100644 --- a/runtime/glbl.h +++ b/runtime/glbl.h @@ -54,6 +54,10 @@ BEGINinterface(glbl) /* name must also be changed in ENDinterface macro! */ SIMP_PROP(DropMalPTRMsgs, int); SIMP_PROP(Option_DisallowWarning, int); SIMP_PROP(DisableDNS, int); + SIMP_PROP(LocalHostName, uchar*) + SIMP_PROP(LocalDomain, uchar*) + SIMP_PROP(StripDomains, char**) + SIMP_PROP(LocalHosts, char**) #undef SIMP_PROP ENDinterface(glbl) #define glblCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */ diff --git a/runtime/net.c b/runtime/net.c index bc4404cb..777d3fad 100644 --- a/runtime/net.c +++ b/runtime/net.c @@ -55,7 +55,6 @@ #include #include -#include "dirty.h" #include "syslogd-types.h" #include "module-template.h" #include "parse.h" @@ -814,7 +813,7 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN */ strcpy((char*)pszHost, (char*)pszHostFQDN); if ((p = (uchar*) strchr((char*)pszHost, '.'))) { /* find start of domain name "machine.example.com" */ - if(strcmp((char*) (p + 1), LocalDomain) == 0) { + if(strcmp((char*)(p + 1), (char*)glbl.GetLocalDomain()) == 0) { *p = '\0'; /* simply terminate the string */ } else { /* now check if we belong to any of the domain names that were specified @@ -823,10 +822,10 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN * For proper modularization, this must be done different, e.g. via a * "to be stripped" property of *this* object itself. */ - if (StripDomains) { + if(glbl.GetStripDomains() != NULL) { count=0; - while (StripDomains[count]) { - if (strcmp((char*)(p + 1), StripDomains[count]) == 0) { + while(glbl.GetStripDomains()[count]) { + if (strcmp((char*)(p + 1), glbl.GetStripDomains()[count]) == 0) { *p = '\0'; FINALIZE; /* we are done */ } @@ -842,10 +841,10 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN * still occurs at *p, which points at the first dot after the hostname. * TODO: this must also go away - see comment above -- rgerhards, 2008-04-16 */ - if (LocalHosts) { + if(glbl.GetLocalHosts() != NULL) { count=0; - while (LocalHosts[count]) { - if (!strcmp((char*)pszHost, LocalHosts[count])) { + while (glbl.GetLocalHosts()[count]) { + if (!strcmp((char*)pszHost, (char*)glbl.GetLocalHosts()[count])) { *p = '\0'; break; /* we are done */ } -- cgit