changeset: 6364:769905e66205 user: Brendan Cully <[email protected]> date: Sun Sep 07 10:52:21 2014 -0700 link: http://dev.mutt.org/hg/mutt/rev/769905e66205
mutt_sasl: whitespace only changeset: 6365:1b583341d5ad user: Brendan Cully <[email protected]> date: Sun Sep 07 11:04:54 2014 -0700 link: http://dev.mutt.org/hg/mutt/rev/1b583341d5ad mutt_sasl: fix double negative in iptostring result check (fixes #3705) diffs (70 lines): diff -r b8bebc2f9a55 -r 1b583341d5ad mutt_sasl.c --- a/mutt_sasl.c Fri Jul 25 20:43:05 2014 +0200 +++ b/mutt_sasl.c Sun Sep 07 11:04:54 2014 -0700 @@ -103,27 +103,29 @@ /* utility function, stolen from sasl2 sample code */ static int iptostring(const struct sockaddr *addr, socklen_t addrlen, - char *out, unsigned outlen) { - char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; - int ret; - - if(!addr || !out) return SASL_BADPARAM; + char *out, unsigned outlen) +{ + char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; + int ret; - ret=getnameinfo(addr, addrlen, hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), - NI_NUMERICHOST | + if (!addr || !out) + return SASL_BADPARAM; + + ret = getnameinfo(addr, addrlen, hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), + NI_NUMERICHOST | #ifdef NI_WITHSCOPEID - NI_WITHSCOPEID | + NI_WITHSCOPEID | #endif - NI_NUMERICSERV); - if(ret) - return getnameinfo_err(ret); + NI_NUMERICSERV); + if (ret) + return getnameinfo_err(ret); - if(outlen < strlen(hbuf) + strlen(pbuf) + 2) - return SASL_BUFOVER; + if (outlen < strlen(hbuf) + strlen(pbuf) + 2) + return SASL_BUFOVER; - snprintf(out, outlen, "%s;%s", hbuf, pbuf); + snprintf(out, outlen, "%s;%s", hbuf, pbuf); - return SASL_OK; + return SASL_OK; } /* mutt_sasl_start: called before doing a SASL exchange - initialises library @@ -195,8 +197,8 @@ size = sizeof (local); if (!getsockname (conn->fd, (struct sockaddr *)&local, &size)) { - if (!iptostring((struct sockaddr *)&local, size, iplocalport, - IP_PORT_BUFLEN) != SASL_OK) + if (iptostring((struct sockaddr *)&local, size, iplocalport, + IP_PORT_BUFLEN) == SASL_OK) plp = iplocalport; else dprint (2, (debugfile, "SASL failed to parse local IP address\n")); @@ -206,8 +208,8 @@ size = sizeof (remote); if (!getpeername (conn->fd, (struct sockaddr *)&remote, &size)){ - if (!iptostring((struct sockaddr *)&remote, size, ipremoteport, - IP_PORT_BUFLEN) != SASL_OK) + if (iptostring((struct sockaddr *)&remote, size, ipremoteport, + IP_PORT_BUFLEN) == SASL_OK) prp = ipremoteport; else dprint (2, (debugfile, "SASL failed to parse remote IP address\n"));
