From 35f217ce69b6dbcdc16ff36ef02323ab3257d9df Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 12 Sep 2012 12:11:12 +0200 Subject: forward-compatibility patch for $ruleset processing v7 needs a different handling, it's easer in the long term if we introduce this in v6 as well. Non-intrusive change. --- grammar/grammar.y | 2 ++ grammar/lexer.l | 3 +++ 2 files changed, 5 insertions(+) diff --git a/grammar/grammar.y b/grammar/grammar.y index 8371f854..29ff02fe 100644 --- a/grammar/grammar.y +++ b/grammar/grammar.y @@ -69,6 +69,7 @@ extern int yyerror(char*); %token BEGIN_TPL %token STOP %token LEGACY_ACTION +%token LEGACY_RULESET %token PRIFILT %token PROPFILT %token BSD_TAG_SELECTOR @@ -129,6 +130,7 @@ conf: /* empty (to end recursion) */ | conf obj { cnfDoObj($2); } | conf rule { cnfDoRule($2); } | conf cfsysline { cnfDoCfsysline($2); } + | conf LEGACY_RULESET { cnfDoCfsysline($2); } | conf BSD_TAG_SELECTOR { cnfDoBSDTag($2); } | conf BSD_HOST_SELECTOR { cnfDoBSDHost($2); } obj: BEGINOBJ nvlst ENDOBJ { $$ = cnfobjNew($1, $2); } diff --git a/grammar/lexer.l b/grammar/lexer.l index c5e7bf7d..0faacf2e 100644 --- a/grammar/lexer.l +++ b/grammar/lexer.l @@ -192,6 +192,9 @@ int fileno(FILE *stream); if(!strncasecmp(yytext, "$includeconfig ", 14)) { yyless(14); BEGIN INCL; + } else if(!strncasecmp(yytext, "$ruleset ", 9)) { + yylval.s = strdup(yytext); + return LEGACY_RULESET; } else { yylval.s = strdup(yytext); return CFSYSLINE; -- cgit v1.2.3 From d1de4cbd92a55c6b930fd84ee9fa5bbfee16aed6 Mon Sep 17 00:00:00 2001 From: Cristian Ionescu-Idbohrn Date: Wed, 12 Sep 2012 12:44:51 +0200 Subject: imuxsock: remove incorrect socket option call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SCM_CREDENTIALS is not a socket option; its value is usually 0x2 which on most archs corresponds to socket option SO_REUSEADDR, but on mips-arch there is no socket option with value 0x2 and SO_REUSEADDR = 0x4, so the call will fail with ENOPROTOOPT 'Protocol not available'; skip it. There does not seem any other special setsockopt call is needed anyway, besides the above. In addition Jonny Törnbom commented: SCM_CREDENTIALS is a control message type, not a socket option, so using setsockopt(...SCM_CREDENTIALS...) is potentially dangerous and wrong and should be deleted from the code. (SCM_CREDENTIALS is used in conjuction with SO_PASSCRED which is the socket option to use.) --- plugins/imuxsock/imuxsock.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index d8922888..b0247d6e 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -427,10 +427,6 @@ openLogSocket(lstn_t *pLstn) errmsg.LogError(errno, NO_ERRCODE, "set SO_PASSCRED failed on '%s'", pLstn->sockName); pLstn->bUseCreds = 0; } - if(setsockopt(pLstn->fd, SOL_SOCKET, SCM_CREDENTIALS, &one, sizeof(one)) != 0) { - errmsg.LogError(errno, NO_ERRCODE, "set SCM_CREDENTIALS failed on '%s'", pLstn->sockName); - pLstn->bUseCreds = 0; - } // TODO: move to its own #if if(setsockopt(pLstn->fd, SOL_SOCKET, SO_TIMESTAMP, &one, sizeof(one)) != 0) { errmsg.LogError(errno, NO_ERRCODE, "set SO_TIMESTAMP failed on '%s'", pLstn->sockName); -- cgit v1.2.3 From 2d538f14e2bae1407a3fb22c4a5244247dda1e4b Mon Sep 17 00:00:00 2001 From: Cristian Ionescu-Idbohrn Date: Wed, 12 Sep 2012 12:59:38 +0200 Subject: remove unused variables (if SCM_CREDENTIALS is not available) --- ChangeLog | 4 ++++ plugins/imuxsock/imuxsock.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3073d2f8..a053d8ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ --------------------------------------------------------------------------- +Version 5.10.1 [V5-STABLE], 2012-0?-?? +- bugfix: remove invalid socket option call from imuxsock + Thanks to Cristian Ionescu-Idbohrn and Jonny Törnbom +--------------------------------------------------------------------------- Version 5.10.0 [V5-STABLE], 2012-08-23 NOTE: this is the new rsyslog v5-stable, incorporating all changes from the diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index b0247d6e..76474724 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -386,7 +386,9 @@ static inline rsRetVal openLogSocket(lstn_t *pLstn) { DEFiRet; +# if HAVE_SCM_CREDENTIALS int one; +# endif /* HAVE_SCM_CREDENTIALS */ if(pLstn->sockName[0] == '\0') return -1; @@ -802,8 +804,10 @@ static rsRetVal readSocket(lstn_t *pLstn) struct ucred *cred; struct timeval *ts; uchar bufRcv[4096+1]; - char aux[128]; uchar *pRcv = NULL; /* receive buffer */ +# if HAVE_SCM_CREDENTIALS + char aux[128]; +# endif assert(pLstn->fd >= 0); -- cgit v1.2.3