fixed a potential segfault condition with $AllowedSender directive

On HUP, the root pointers were not properly cleaned up. Thanks to
Michael Biebel, olgoat, and Juha Koho for reporting and analyzing
the bug.
This commit is contained in:
Rainer Gerhards 2009-01-12 13:05:45 +01:00
parent 197d980f5b
commit 20ff1ed403
2 changed files with 33 additions and 0 deletions

View File

@ -1,3 +1,7 @@
- fixed a potential segfault condition with $AllowedSender directive
On HUP, the root pointers were not properly cleaned up. Thanks to
Michael Biebel, olgoat, and Juha Koho for reporting and analyzing
the bug.
- some legacy options were not correctly processed.
Thanks to varmojfekoj for the patch.
- doc bugfix: some spelling errors in man pages corrected. Thanks to

29
net.c
View File

@ -105,6 +105,30 @@ setAllowRoot(struct AllowedSenders **ppAllowRoot, uchar *pszType)
finalize_it:
RETiRet;
}
/* re-initializes (sets to NULL) the correct allow root pointer
* rgerhards, 2009-01-12
*/
static inline rsRetVal
reinitAllowRoot(uchar *pszType)
{
DEFiRet;
if(!strcmp((char*)pszType, "UDP"))
pAllowedSenders_UDP = NULL;
else if(!strcmp((char*)pszType, "TCP"))
pAllowedSenders_TCP = NULL;
#ifdef USE_GSSAPI
else if(!strcmp((char*)pszType, "GSS"))
pAllowedSenders_GSS = NULL;
#endif
else {
dbgprintf("program error: invalid allowed sender ID '%s', denying...\n", pszType);
ABORT_FINALIZE(RS_RET_CODE_ERR); /* everything is invalid for an invalid type */
}
finalize_it:
RETiRet;
}
/* Code for handling allowed/disallowed senders
@ -214,6 +238,11 @@ clearAllowedSenders(uchar *pszType)
free(pPrev->allowedSender.addr.NetAddr);
free(pPrev);
}
/* indicate root pointer is de-init (was forgotten previously, resulting in
* all kinds of interesting things) -- rgerhards, 2009-01-12
*/
reinitAllowRoot(pszType);
}