ph10 2006/10/16 11:37:20 BST
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src/auths pwcheck.c
Log:
Tidy inconsistency in handling the "reply" argument by removing the
tests for NULL (only some times did it do it).
Revision Changes Path
1.407 +6 -0 exim/exim-doc/doc-txt/ChangeLog
1.4 +12 -12 exim/exim-src/src/auths/pwcheck.c
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.406
retrieving revision 1.407
diff -u -r1.406 -r1.407
--- ChangeLog 10 Oct 2006 15:36:50 -0000 1.406
+++ ChangeLog 16 Oct 2006 10:37:19 -0000 1.407
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.406 2006/10/10 15:36:50 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.407 2006/10/16 10:37:19 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -127,6 +127,12 @@
while scanning a header line wasn't quite right (mostly, not resetting
the flag correctly in the right place). These bugs could have caused
trouble for malformed header lines. I hope it is now all correct.
+
+PH/19 The functions {pwcheck,saslauthd}_verify_password() are always called
+ with the "reply" argument non-NULL. The code, however (which originally
+ came from elsewhere) had *some* tests for NULL when it wrote to *reply,
+ but it didn't always do it. This confused somebody who was copying the
+ code for some other use. I have removed all the tests.
Exim version 4.63
Index: pwcheck.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/auths/pwcheck.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- pwcheck.c 5 Sep 2006 14:05:43 -0000 1.3
+++ pwcheck.c 16 Oct 2006 10:37:19 -0000 1.4
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/auths/pwcheck.c,v 1.3 2006/09/05 14:05:43 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/auths/pwcheck.c,v 1.4 2006/10/16 10:37:19 ph10 Exp $ */
/* SASL server API implementation
* Rob Siemborski
@@ -50,6 +50,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@???
*
@@ -107,7 +110,7 @@
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 +122,7 @@
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 +147,7 @@
}
response[start] = '\0';
- if (reply) { *reply = response; }
+ *reply = response;
return PWCHECK_NO;
}
@@ -191,13 +194,11 @@
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 +208,12 @@
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;
}