From e16a207726dce038835cdc12a928a95b5b915440 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 17 Apr 2008 09:40:41 +0200 Subject: moved "bDropMalPTRMsgs" variable to global data pool --- dirty.h | 2 -- runtime/glbl.h | 2 ++ runtime/net.c | 2 +- runtime/obj-types.h | 10 ++++++++++ tools/syslogd.c | 7 ++----- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/dirty.h b/dirty.h index 9e15b4ab..e4f79901 100644 --- a/dirty.h +++ b/dirty.h @@ -42,8 +42,6 @@ extern char **StripDomains; extern char *LocalDomain; extern char**LocalHosts; extern uchar *LocalHostName; -//extern int family; -extern int bDropMalPTRMsgs; extern int option_DisallowWarning; #define MSG_PARSE_HOSTNAME 1 diff --git a/runtime/glbl.h b/runtime/glbl.h index dfde902f..c309fec4 100644 --- a/runtime/glbl.h +++ b/runtime/glbl.h @@ -49,6 +49,8 @@ BEGINinterface(glbl) /* name must also be changed in ENDinterface macro! */ uchar* (*GetWorkDir)(void); int (*GetDefPFFamily)(void); rsRetVal (*SetDefPFFamily)(int); + int (*GetDropMalPTRMsgs)(void); + rsRetVal (*SetDropMalPTRMsgs)(int); 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 6d67693f..b61e4c15 100644 --- a/runtime/net.c +++ b/runtime/net.c @@ -685,7 +685,7 @@ gethname(struct sockaddr_storage *f, uchar *pszHostFQDN) * time being, we simply drop the name we obtained and use the IP - that one * is OK in any way. We do also log the error message. rgerhards, 2007-07-16 */ - if(bDropMalPTRMsgs == 1) { + if(glbl.GetDropMalPTRMsgs() == 1) { snprintf((char*)szErrMsg, sizeof(szErrMsg) / sizeof(uchar), "Malicious PTR record, message dropped " "IP = \"%s\" HOST = \"%s\"", diff --git a/runtime/obj-types.h b/runtime/obj-types.h index 32589646..e245b633 100644 --- a/runtime/obj-types.h +++ b/runtime/obj-types.h @@ -114,6 +114,16 @@ typedef struct obj { /* the dummy struct that each derived class can be casted t # define ISOBJ_assert(pObj) #endif +/* a set method for *very simple* object accesses. Note that this does + * NOT conform to the standard calling conventions and should be + * used only if actually nothing can go wrong! -- rgerhards, 2008-04-17 + */ +#define DEFpropGetMeth(obj, prop, dataType)\ + dataType obj##Get##prop(void)\ + { \ + return pThis->prop = pVal; \ + } + #define DEFpropSetMethPTR(obj, prop, dataType)\ rsRetVal obj##Set##prop(obj##_t *pThis, dataType *pVal)\ { \ diff --git a/tools/syslogd.c b/tools/syslogd.c index 90beba24..5cb0cb38 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -283,7 +283,6 @@ int iCompatibilityMode = 0; /* version we should be compatible with; 0 means sy static int bDebugPrintTemplateList = 1;/* output template list in debug mode? */ static int bDebugPrintCfSysLineHandlerList = 1;/* output cfsyslinehandler list in debug mode? */ static int bDebugPrintModuleList = 1;/* output module list in debug mode? */ -int bDropMalPTRMsgs = 0;/* Drop messages which have malicious PTR records during DNS lookup */ static uchar cCCEscapeChar = '\\';/* character to be used to start an escape sequence for control chars */ static int bEscapeCCOnRcv = 1; /* escape control characters on reception: 0 - no, 1 - yes */ int bReduceRepeatMsgs; /* reduce repeated message - 0 - no, 1 - yes */ @@ -371,7 +370,6 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a bDebugPrintModuleList = 1; bEscapeCCOnRcv = 1; /* default is to escape control characters */ bReduceRepeatMsgs = 0; - bDropMalPTRMsgs = 0; if(pszMainMsgQFName != NULL) { free(pszMainMsgQFName); pszMainMsgQFName = NULL; @@ -2107,10 +2105,10 @@ static void dbgPrintInitInfo(void) dbgPrintCfSysLineHandlers(); dbgprintf("Messages with malicious PTR DNS Records are %sdropped.\n", - bDropMalPTRMsgs ? "" : "not "); + glbl.GetDropMalPTRMsgs() ? "" : "not "); dbgprintf("Control characters are %sreplaced upon reception.\n", - bEscapeCCOnRcv? "" : "not "); + bEscapeCCOnRcv? "" : "not "); if(bEscapeCCOnRcv) dbgprintf("Control character escape sequence prefix is '%c'.\n", @@ -2639,7 +2637,6 @@ static rsRetVal loadBuildInModules(void) CHKiRet(regCfSysLineHdlr((uchar *)"actionresumeinterval", 0, eCmdHdlrInt, setActionResumeInterval, NULL, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"controlcharacterescapeprefix", 0, eCmdHdlrGetChar, NULL, &cCCEscapeChar, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"escapecontrolcharactersonreceive", 0, eCmdHdlrBinary, NULL, &bEscapeCCOnRcv, NULL)); - CHKiRet(regCfSysLineHdlr((uchar *)"dropmsgswithmaliciousdnsptrrecords", 0, eCmdHdlrBinary, NULL, &bDropMalPTRMsgs, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"droptrailinglfonreception", 0, eCmdHdlrBinary, NULL, &bDropTrailingLF, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"template", 0, eCmdHdlrCustomHandler, conf.doNameLine, (void*)DIR_TEMPLATE, NULL)); CHKiRet(regCfSysLineHdlr((uchar *)"outchannel", 0, eCmdHdlrCustomHandler, conf.doNameLine, (void*)DIR_OUTCHANNEL, NULL)); -- cgit