dovecot-2.0: auth: Crashfix when aborting auth request doing asy...

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 23 18:09:17 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/d2b49c7d4046
changeset: 12035:d2b49c7d4046
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 23 16:09:11 2010 +0100
description:
auth: Crashfix when aborting auth request doing async passdb/userdb lookup.

diffstat:

 src/auth/auth-request-handler.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 8b85c3b89343 -r d2b49c7d4046 src/auth/auth-request-handler.c
--- a/src/auth/auth-request-handler.c	Mon Aug 23 15:59:22 2010 +0100
+++ b/src/auth/auth-request-handler.c	Mon Aug 23 16:09:11 2010 +0100
@@ -66,10 +66,22 @@
 	while (hash_table_iterate(iter, &key, &value)) {
 		struct auth_request *auth_request = value;
 
-		auth_request_unref(&auth_request);
+		switch (auth_request->state) {
+		case AUTH_REQUEST_STATE_NEW:
+		case AUTH_REQUEST_STATE_MECH_CONTINUE:
+		case AUTH_REQUEST_STATE_FINISHED:
+			auth_request_unref(&auth_request);
+			hash_table_remove(handler->requests, key);
+			break;
+		case AUTH_REQUEST_STATE_PASSDB:
+		case AUTH_REQUEST_STATE_USERDB:
+			/* can't abort a pending passdb/userdb lookup */
+			break;
+		case AUTH_REQUEST_STATE_MAX:
+			i_unreached();
+		}
 	}
 	hash_table_iterate_deinit(&iter);
-	hash_table_clear(handler->requests, TRUE);
 }
 
 void auth_request_handler_unref(struct auth_request_handler **_handler)


More information about the dovecot-cvs mailing list