dovecot: Don't crash if blocking passdb doesn't support credenti...

dovecot at dovecot.org dovecot at dovecot.org
Thu Aug 9 15:05:16 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/f4739631ce87
changeset: 6243:f4739631ce87
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Aug 09 15:05:12 2007 +0300
description:
Don't crash if blocking passdb doesn't support credential lookups.

diffstat:

2 files changed, 12 insertions(+), 6 deletions(-)
src/auth/auth-request.c       |   12 ++++++------
src/auth/auth-worker-client.c |    6 ++++++

diffs (41 lines):

diff -r 40e324d83d2b -r f4739631ce87 src/auth/auth-request.c
--- a/src/auth/auth-request.c	Thu Aug 09 14:48:10 2007 +0300
+++ b/src/auth/auth-request.c	Thu Aug 09 15:05:12 2007 +0300
@@ -555,15 +555,15 @@ void auth_request_lookup_credentials(str
 
 	request->state = AUTH_REQUEST_STATE_PASSDB;
 
-	if (passdb->blocking)
-		passdb_blocking_lookup_credentials(request);
-	else if (passdb->iface.lookup_credentials != NULL) {
-		passdb->iface.lookup_credentials(request,
-			auth_request_lookup_credentials_callback);
-	} else {
+	if (passdb->iface.lookup_credentials == NULL) {
 		/* this passdb doesn't support credentials */
 		auth_request_lookup_credentials_callback(
 			PASSDB_RESULT_SCHEME_NOT_AVAILABLE, NULL, 0, request);
+	} else if (passdb->blocking) {
+		passdb_blocking_lookup_credentials(request);
+	} else {
+		passdb->iface.lookup_credentials(request,
+			auth_request_lookup_credentials_callback);
 	}
 }
 
diff -r 40e324d83d2b -r f4739631ce87 src/auth/auth-worker-client.c
--- a/src/auth/auth-worker-client.c	Thu Aug 09 14:48:10 2007 +0300
+++ b/src/auth/auth-worker-client.c	Thu Aug 09 15:05:12 2007 +0300
@@ -259,6 +259,12 @@ auth_worker_handle_passl(struct auth_wor
 		}
 	}
 
+	if (auth_request->passdb->passdb->iface.lookup_credentials == NULL) {
+		i_error("BUG: PASSL lookup not supported by given passdb");
+		auth_request_unref(&auth_request);
+		return;
+	}
+
 	auth_request->passdb->passdb->iface.
 		lookup_credentials(auth_request, lookup_credentials_callback);
 }


More information about the dovecot-cvs mailing list