dovecot-2.2: auth: checkpassword callback callback type bike-she...

dovecot at dovecot.org dovecot at dovecot.org
Tue May 27 18:19:21 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/51d44a72237c
changeset: 17413:51d44a72237c
user:      Phil Carmody <phil at dovecot.fi>
date:      Tue May 27 21:17:34 2014 +0300
description:
auth: checkpassword callback callback type bike-shedding
This change doesn't change the compiler's (gcc) view on the correctness of
the code. It moves sparse's attention of where the potential issues are
though. Sparse used to complain about dodgy function pointer conversions on
both the way out (passing the callback function pointer), and on the way in
(entering the callback). Making the callback not lie about what it receives
gets rid of the way in warnings, but adds warnings as we pass the new
function pointer out. However, it already complains about that call anyway.
So it complains about 6 things in 3 functions rather than 6 things in 6
functions.

Of dubious worth, but it at least reduces the number of lines you need to
inspect to verify correctness.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/auth/passdb-checkpassword.c |  6 ++----
 src/auth/userdb-checkpassword.c |  3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r 3f4d224f2e6a -r 51d44a72237c src/auth/passdb-checkpassword.c
--- a/src/auth/passdb-checkpassword.c	Tue May 27 21:17:34 2014 +0300
+++ b/src/auth/passdb-checkpassword.c	Tue May 27 21:17:34 2014 +0300
@@ -17,9 +17,8 @@
 auth_checkpassword_callback(struct auth_request *request,
 			    enum db_checkpassword_status status,
 			    const char *const *extra_fields,
-			    void (*request_callback)())
+			    verify_plain_callback_t *callback)
 {
-	verify_plain_callback_t *callback = request_callback;
 	const char *scheme, *crypted_pass = NULL;
 	unsigned int i;
 
@@ -71,9 +70,8 @@
 credentials_checkpassword_callback(struct auth_request *request,
 				   enum db_checkpassword_status status,
 				   const char *const *extra_fields,
-				   void (*request_callback)())
+				   lookup_credentials_callback_t *callback)
 {
-	lookup_credentials_callback_t *callback = request_callback;
 	const char *scheme, *crypted_pass = NULL;
 	unsigned int i;
 
diff -r 3f4d224f2e6a -r 51d44a72237c src/auth/userdb-checkpassword.c
--- a/src/auth/userdb-checkpassword.c	Tue May 27 21:17:34 2014 +0300
+++ b/src/auth/userdb-checkpassword.c	Tue May 27 21:17:34 2014 +0300
@@ -16,9 +16,8 @@
 userdb_checkpassword_callback(struct auth_request *request,
 			      enum db_checkpassword_status status,
 			      const char *const *extra_fields,
-			      void (*request_callback)())
+			      userdb_callback_t *callback)
 {
-	userdb_callback_t *callback = request_callback;
 	unsigned int i;
 
 	switch (status) {


More information about the dovecot-cvs mailing list