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(-) (limited to 'plugins') 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 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) --- plugins/imuxsock/imuxsock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') 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