mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-08-30 15:10:18 +02:00
Merge branch 'v3-stable' into beta
Conflicts: runtime/rsyslog.h
This commit is contained in:
commit
fae8f451ab
@ -122,6 +122,8 @@ Version 3.21.0 [DEVEL] (rgerhards), 2008-07-18
|
|||||||
see below)
|
see below)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
Version 3.20.1 [v3-stable] (rgerhards), 2008-11-??
|
Version 3.20.1 [v3-stable] (rgerhards), 2008-11-??
|
||||||
|
- security bugfix: $AllowedSender was not honored, all senders were
|
||||||
|
permitted instead
|
||||||
- enhance: regex nomatch option "ZERO" has been added
|
- enhance: regex nomatch option "ZERO" has been added
|
||||||
This allows to return the string 0 if a regular expression is
|
This allows to return the string 0 if a regular expression is
|
||||||
not found. This is probably useful for storing numerical values into
|
not found. This is probably useful for storing numerical values into
|
||||||
|
|||||||
@ -563,9 +563,7 @@ filter on any property, like HOSTNAME, syslogtag and msg. A list of all
|
|||||||
currently-supported properties can be found in the <a href="property_replacer.html">property replacer documentation</a>
|
currently-supported properties can be found in the <a href="property_replacer.html">property replacer documentation</a>
|
||||||
(but keep in mind that only the properties, not the replacer is
|
(but keep in mind that only the properties, not the replacer is
|
||||||
supported). With this filter, each properties can be checked against a
|
supported). With this filter, each properties can be checked against a
|
||||||
specified value, using a specified compare operation. Currently, there
|
specified value, using a specified compare operation.</p>
|
||||||
is only a single compare operation (contains) available, but additional
|
|
||||||
operations will be added in the future.</p>
|
|
||||||
<p>A property-based filter must start with a colon in column 0.
|
<p>A property-based filter must start with a colon in column 0.
|
||||||
This tells rsyslogd that it is the new filter type. The colon must be
|
This tells rsyslogd that it is the new filter type. The colon must be
|
||||||
followed by the property name, a comma, the name of the compare
|
followed by the property name, a comma, the name of the compare
|
||||||
|
|||||||
@ -176,10 +176,10 @@ isPermittedHost(struct sockaddr *addr, char *fromHostFQDN, void *pUsrSrv, void*p
|
|||||||
pGSess = (gss_sess_t*) pUsrSess;
|
pGSess = (gss_sess_t*) pUsrSess;
|
||||||
|
|
||||||
if((pGSrv->allowedMethods & ALLOWEDMETHOD_TCP) &&
|
if((pGSrv->allowedMethods & ALLOWEDMETHOD_TCP) &&
|
||||||
net.isAllowedSender(net.pAllowedSenders_TCP, addr, (char*)fromHostFQDN))
|
net.isAllowedSender((uchar*)"TCP", addr, (char*)fromHostFQDN))
|
||||||
allowedMethods |= ALLOWEDMETHOD_TCP;
|
allowedMethods |= ALLOWEDMETHOD_TCP;
|
||||||
if((pGSrv->allowedMethods & ALLOWEDMETHOD_GSS) &&
|
if((pGSrv->allowedMethods & ALLOWEDMETHOD_GSS) &&
|
||||||
net.isAllowedSender(net.pAllowedSenders_GSS, addr, (char*)fromHostFQDN))
|
net.isAllowedSender((uchar*)"GSS", addr, (char*)fromHostFQDN))
|
||||||
allowedMethods |= ALLOWEDMETHOD_GSS;
|
allowedMethods |= ALLOWEDMETHOD_GSS;
|
||||||
if(allowedMethods && pGSess != NULL)
|
if(allowedMethods && pGSess != NULL)
|
||||||
pGSess->allowedMethods = allowedMethods;
|
pGSess->allowedMethods = allowedMethods;
|
||||||
@ -187,6 +187,7 @@ isPermittedHost(struct sockaddr *addr, char *fromHostFQDN, void *pUsrSrv, void*p
|
|||||||
return allowedMethods;
|
return allowedMethods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static rsRetVal
|
static rsRetVal
|
||||||
onSessAccept(tcpsrv_t *pThis, tcps_sess_t *pSess)
|
onSessAccept(tcpsrv_t *pThis, tcps_sess_t *pSess)
|
||||||
{
|
{
|
||||||
@ -663,14 +664,8 @@ ENDmodExit
|
|||||||
BEGINafterRun
|
BEGINafterRun
|
||||||
CODESTARTafterRun
|
CODESTARTafterRun
|
||||||
/* do cleanup here */
|
/* do cleanup here */
|
||||||
if (net.pAllowedSenders_TCP != NULL) {
|
net.clearAllowedSenders((uchar*)"TCP");
|
||||||
net.clearAllowedSenders (net.pAllowedSenders_TCP);
|
net.clearAllowedSenders((uchar*)"GSS");
|
||||||
net.pAllowedSenders_TCP = NULL;
|
|
||||||
}
|
|
||||||
if (net.pAllowedSenders_GSS != NULL) {
|
|
||||||
net.clearAllowedSenders (net.pAllowedSenders_GSS);
|
|
||||||
net.pAllowedSenders_GSS = NULL;
|
|
||||||
}
|
|
||||||
ENDafterRun
|
ENDafterRun
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -89,7 +89,7 @@ static int
|
|||||||
isPermittedHost(struct sockaddr *addr, char *fromHostFQDN, void __attribute__((unused)) *pUsrSrv,
|
isPermittedHost(struct sockaddr *addr, char *fromHostFQDN, void __attribute__((unused)) *pUsrSrv,
|
||||||
void __attribute__((unused)) *pUsrSess)
|
void __attribute__((unused)) *pUsrSess)
|
||||||
{
|
{
|
||||||
return net.isAllowedSender(net.pAllowedSenders_TCP, addr, fromHostFQDN);
|
return net.isAllowedSender((uchar*) "TCP", addr, fromHostFQDN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -212,10 +212,7 @@ ENDwillRun
|
|||||||
BEGINafterRun
|
BEGINafterRun
|
||||||
CODESTARTafterRun
|
CODESTARTafterRun
|
||||||
/* do cleanup here */
|
/* do cleanup here */
|
||||||
if(net.pAllowedSenders_TCP != NULL) {
|
net.clearAllowedSenders((uchar*)"TCP");
|
||||||
net.clearAllowedSenders(net.pAllowedSenders_TCP);
|
|
||||||
net.pAllowedSenders_TCP = NULL;
|
|
||||||
}
|
|
||||||
ENDafterRun
|
ENDafterRun
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -193,7 +193,7 @@ CODESTARTrunInput
|
|||||||
* configured to do this).
|
* configured to do this).
|
||||||
* rgerhards, 2005-09-26
|
* rgerhards, 2005-09-26
|
||||||
*/
|
*/
|
||||||
if(net.isAllowedSender(net.pAllowedSenders_UDP,
|
if(net.isAllowedSender((uchar*) "UDP",
|
||||||
(struct sockaddr *)&frominet, (char*)fromHostFQDN)) {
|
(struct sockaddr *)&frominet, (char*)fromHostFQDN)) {
|
||||||
parseAndSubmitMessage(fromHost, fromHostIP, pRcvBuf, l,
|
parseAndSubmitMessage(fromHost, fromHostIP, pRcvBuf, l,
|
||||||
MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_NO_DELAY, (uchar*)"imudp");
|
MSG_PARSE_HOSTNAME, NOFLAG, eFLOWCTL_NO_DELAY, (uchar*)"imudp");
|
||||||
@ -244,10 +244,7 @@ ENDwillRun
|
|||||||
BEGINafterRun
|
BEGINafterRun
|
||||||
CODESTARTafterRun
|
CODESTARTafterRun
|
||||||
/* do cleanup here */
|
/* do cleanup here */
|
||||||
if (net.pAllowedSenders_UDP != NULL) {
|
net.clearAllowedSenders((uchar*)"UDP");
|
||||||
net.clearAllowedSenders (net.pAllowedSenders_UDP);
|
|
||||||
net.pAllowedSenders_UDP = NULL;
|
|
||||||
}
|
|
||||||
if(udpLstnSocks != NULL) {
|
if(udpLstnSocks != NULL) {
|
||||||
net.closeUDPListenSockets(udpLstnSocks);
|
net.closeUDPListenSockets(udpLstnSocks);
|
||||||
udpLstnSocks = NULL;
|
udpLstnSocks = NULL;
|
||||||
|
|||||||
@ -92,6 +92,30 @@ int ACLDontResolve = 0; /* add hostname to acl instead of resolving it
|
|||||||
/* ------------------------------ begin permitted peers code ------------------------------ */
|
/* ------------------------------ begin permitted peers code ------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
|
/* sets the correct allow root pointer based on provided type
|
||||||
|
* rgerhards, 2008-12-01
|
||||||
|
*/
|
||||||
|
static inline rsRetVal
|
||||||
|
setAllowRoot(struct AllowedSenders **ppAllowRoot, uchar *pszType)
|
||||||
|
{
|
||||||
|
DEFiRet;
|
||||||
|
|
||||||
|
if(!strcmp((char*)pszType, "UDP"))
|
||||||
|
*ppAllowRoot = pAllowedSenders_UDP;
|
||||||
|
else if(!strcmp((char*)pszType, "TCP"))
|
||||||
|
*ppAllowRoot = pAllowedSenders_TCP;
|
||||||
|
else if(!strcmp((char*)pszType, "GSS"))
|
||||||
|
*ppAllowRoot = pAllowedSenders_GSS;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* add a wildcard entry to this permitted peer. Entries are always
|
/* add a wildcard entry to this permitted peer. Entries are always
|
||||||
* added at the tail of the list. pszStr and lenStr identify the wildcard
|
* added at the tail of the list. pszStr and lenStr identify the wildcard
|
||||||
* entry to be added. Note that the string is NOT \0 terminated, so
|
* entry to be added. Note that the string is NOT \0 terminated, so
|
||||||
@ -507,27 +531,32 @@ static rsRetVal AddAllowedSenderEntry(struct AllowedSenders **ppRoot, struct All
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* function to clear the allowed sender structure in cases where
|
/* function to clear the allowed sender structure in cases where
|
||||||
* it must be freed (occurs most often when HUPed.
|
* it must be freed (occurs most often when HUPed).
|
||||||
* TODO: reconsider recursive implementation
|
* rgerhards, 2008-12-02: revamped this code when we fixed the interface
|
||||||
* I think there is also a memory leak, because only the last entry
|
* definition. Now an iterative algorithm is used.
|
||||||
* is acutally deleted... -- rgerhards, 2007-12-25
|
|
||||||
*/
|
*/
|
||||||
void clearAllowedSenders (struct AllowedSenders *pAllow)
|
static void
|
||||||
|
clearAllowedSenders(uchar *pszType)
|
||||||
{
|
{
|
||||||
if (pAllow != NULL) {
|
struct AllowedSenders *pPrev;
|
||||||
if (pAllow->pNext != NULL)
|
struct AllowedSenders *pCurr;
|
||||||
clearAllowedSenders (pAllow->pNext);
|
|
||||||
else {
|
if(setAllowRoot(&pCurr, pszType) != RS_RET_OK)
|
||||||
if (F_ISSET(pAllow->allowedSender.flags, ADDR_NAME))
|
return; /* if something went wrong, so let's leave */
|
||||||
free (pAllow->allowedSender.addr.HostWildcard);
|
|
||||||
else
|
while(pCurr != NULL) {
|
||||||
free (pAllow->allowedSender.addr.NetAddr);
|
pPrev = pCurr;
|
||||||
|
pCurr = pCurr->pNext;
|
||||||
free (pAllow);
|
/* now delete the entry we are right now processing */
|
||||||
}
|
if(F_ISSET(pPrev->allowedSender.flags, ADDR_NAME))
|
||||||
|
free(pPrev->allowedSender.addr.HostWildcard);
|
||||||
|
else
|
||||||
|
free(pPrev->allowedSender.addr.NetAddr);
|
||||||
|
free(pPrev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* function to add an allowed sender to the allowed sender list. The
|
/* function to add an allowed sender to the allowed sender list. The
|
||||||
* root of the list is caller-provided, so it can be used for all
|
* root of the list is caller-provided, so it can be used for all
|
||||||
* supported lists. The caller must provide a pointer to the root,
|
* supported lists. The caller must provide a pointer to the root,
|
||||||
@ -905,11 +934,15 @@ static inline int MaskCmp(struct NetAddr *pAllow, uint8_t bits, struct sockaddr
|
|||||||
* returns 1, if the sender is allowed, 0 otherwise.
|
* returns 1, if the sender is allowed, 0 otherwise.
|
||||||
* rgerhards, 2005-09-26
|
* rgerhards, 2005-09-26
|
||||||
*/
|
*/
|
||||||
static int isAllowedSender(struct AllowedSenders *pAllowRoot, struct sockaddr *pFrom, const char *pszFromHost)
|
static int isAllowedSender(uchar *pszType, struct sockaddr *pFrom, const char *pszFromHost)
|
||||||
{
|
{
|
||||||
struct AllowedSenders *pAllow;
|
struct AllowedSenders *pAllow;
|
||||||
|
struct AllowedSenders *pAllowRoot;
|
||||||
|
|
||||||
assert(pFrom != NULL);
|
assert(pFrom != NULL);
|
||||||
|
|
||||||
|
if(setAllowRoot(&pAllowRoot, pszType) != RS_RET_OK)
|
||||||
|
return 0; /* if something went wrong, we denie access - that's the better choice... */
|
||||||
|
|
||||||
if(pAllowRoot == NULL)
|
if(pAllowRoot == NULL)
|
||||||
return 1; /* checking disabled, everything is valid! */
|
return 1; /* checking disabled, everything is valid! */
|
||||||
|
|||||||
@ -135,11 +135,11 @@ BEGINinterface(net) /* name must also be changed in ENDinterface macro! */
|
|||||||
/* things to go away after proper modularization */
|
/* things to go away after proper modularization */
|
||||||
rsRetVal (*addAllowedSenderLine)(char* pName, uchar** ppRestOfConfLine);
|
rsRetVal (*addAllowedSenderLine)(char* pName, uchar** ppRestOfConfLine);
|
||||||
void (*PrintAllowedSenders)(int iListToPrint);
|
void (*PrintAllowedSenders)(int iListToPrint);
|
||||||
void (*clearAllowedSenders) ();
|
void (*clearAllowedSenders)(uchar*);
|
||||||
void (*debugListenInfo)(int fd, char *type);
|
void (*debugListenInfo)(int fd, char *type);
|
||||||
int *(*create_udp_socket)(uchar *hostname, uchar *LogPort, int bIsServer);
|
int *(*create_udp_socket)(uchar *hostname, uchar *LogPort, int bIsServer);
|
||||||
void (*closeUDPListenSockets)(int *finet);
|
void (*closeUDPListenSockets)(int *finet);
|
||||||
int (*isAllowedSender)(struct AllowedSenders *pAllowRoot, struct sockaddr *pFrom, const char *pszFromHost);
|
int (*isAllowedSender)(uchar *pszType, struct sockaddr *pFrom, const char *pszFromHost);
|
||||||
rsRetVal (*getLocalHostname)(uchar**);
|
rsRetVal (*getLocalHostname)(uchar**);
|
||||||
int (*should_use_so_bsdcompat)(void);
|
int (*should_use_so_bsdcompat)(void);
|
||||||
/* permitted peer handling should be replaced by something better (see comments above) */
|
/* permitted peer handling should be replaced by something better (see comments above) */
|
||||||
@ -149,9 +149,6 @@ BEGINinterface(net) /* name must also be changed in ENDinterface macro! */
|
|||||||
/* data members - these should go away over time... TODO */
|
/* data members - these should go away over time... TODO */
|
||||||
int *pACLAddHostnameOnFail; /* add hostname to acl when DNS resolving has failed */
|
int *pACLAddHostnameOnFail; /* add hostname to acl when DNS resolving has failed */
|
||||||
int *pACLDontResolve; /* add hostname to acl instead of resolving it to IP(s) */
|
int *pACLDontResolve; /* add hostname to acl instead of resolving it to IP(s) */
|
||||||
struct AllowedSenders *pAllowedSenders_UDP;
|
|
||||||
struct AllowedSenders *pAllowedSenders_TCP;
|
|
||||||
struct AllowedSenders *pAllowedSenders_GSS;
|
|
||||||
ENDinterface(net)
|
ENDinterface(net)
|
||||||
#define netCURR_IF_VERSION 4 /* increment whenever you change the interface structure! */
|
#define netCURR_IF_VERSION 4 /* increment whenever you change the interface structure! */
|
||||||
|
|
||||||
|
|||||||
@ -252,6 +252,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
|
|||||||
RS_RET_QUEUE_FULL = -2105, /**< queue is full, operation could not be completed */
|
RS_RET_QUEUE_FULL = -2105, /**< queue is full, operation could not be completed */
|
||||||
RS_RET_ACCEPT_ERR = -2106, /**< error during accept() system call */
|
RS_RET_ACCEPT_ERR = -2106, /**< error during accept() system call */
|
||||||
RS_RET_INVLD_TIME = -2107, /**< invalid timestamp (e.g. could not be parsed) */
|
RS_RET_INVLD_TIME = -2107, /**< invalid timestamp (e.g. could not be parsed) */
|
||||||
|
RS_RET_CODE_ERR = -2109, /**< program code (internal) error */
|
||||||
|
|
||||||
/* RainerScript error messages (range 1000.. 1999) */
|
/* RainerScript error messages (range 1000.. 1999) */
|
||||||
RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */
|
RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user