X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/f1e894f37fb99398f7447220925a915bd031491a..d88f0784c1400a06efb1b09d0bfcfa31c284c7d7:/src/src/auths/pwcheck.c diff --git a/src/src/auths/pwcheck.c b/src/src/auths/pwcheck.c index 115c1454d..645265daa 100644 --- a/src/src/auths/pwcheck.c +++ b/src/src/auths/pwcheck.c @@ -1,5 +1,3 @@ -/* $Cambridge: exim/src/src/auths/pwcheck.c,v 1.2 2005/06/27 14:29:44 ph10 Exp $ */ - /* SASL server API implementation * Rob Siemborski * Tim Martin @@ -50,6 +48,9 @@ * Oct 2001 - Apr 2002: Slightly modified by Philip Hazel. * Aug 2003: new code for saslauthd from Alexander S. Sabourenkov incorporated * by Philip Hazel (minor mods to avoid compiler warnings) + * Oct 2006: (PH) removed redundant tests on "reply" being NULL - some were + * missing, and confused someone who was using this code for some + * other purpose. Here in Exim, "reply" is never NULL. * * screwdriver@lxnt.info * @@ -107,7 +108,7 @@ return PWCHECK_FAIL; struct iovec iov[2]; static char response[1024]; - if (reply) { *reply = NULL; } + *reply = NULL; s = socket(AF_UNIX, SOCK_STREAM, 0); if (s == -1) { return PWCHECK_FAIL; } @@ -119,7 +120,7 @@ return PWCHECK_FAIL; if (r == -1) { DEBUG(D_auth) debug_printf("Cannot connect to pwcheck daemon (at '%s')\n",CYRUS_PWCHECK_SOCKET); - if (reply) { *reply = "cannot connect to pwcheck daemon"; } + *reply = "cannot connect to pwcheck daemon"; return PWCHECK_FAIL; } @@ -144,7 +145,7 @@ return PWCHECK_FAIL; } response[start] = '\0'; - if (reply) { *reply = response; } + *reply = response; return PWCHECK_NO; } @@ -183,7 +184,7 @@ int saslauthd_verify_password(const uschar *userid, const uschar *realm, const uschar **reply) { - uschar *daemon_reply; + uschar *daemon_reply = NULL; int s, r; struct sockaddr_un srvaddr; @@ -191,13 +192,11 @@ int saslauthd_verify_password(const uschar *userid, debug_printf("saslauthd userid='%s' servicename='%s'" " realm='%s'\n", userid, service, realm ); - if (reply) - *reply = NULL; + *reply = NULL; s = socket(AF_UNIX, SOCK_STREAM, 0); if (s == -1) { - if (reply) - *reply = CUstrerror(errno); + *reply = CUstrerror(errno); return PWCHECK_FAIL; } @@ -207,13 +206,12 @@ int saslauthd_verify_password(const uschar *userid, sizeof(srvaddr.sun_path)); r = connect(s, (struct sockaddr *)&srvaddr, sizeof(srvaddr)); if (r == -1) { - DEBUG(D_auth) + DEBUG(D_auth) debug_printf("Cannot connect to saslauthd daemon (at '%s'): %s\n", CYRUS_SASLAUTHD_SOCKET, strerror(errno)); - if (reply) - *reply = string_sprintf("cannot connect to saslauthd daemon at " - "%s: %s", CYRUS_SASLAUTHD_SOCKET, - strerror(errno)); + *reply = string_sprintf("cannot connect to saslauthd daemon at " + "%s: %s", CYRUS_SASLAUTHD_SOCKET, + strerror(errno)); return PWCHECK_FAIL; }