]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Crashfix when aborting auth request doing async passdb/userdb lookup.
authorTimo Sirainen <tss@iki.fi>
Mon, 23 Aug 2010 15:09:11 +0000 (16:09 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 23 Aug 2010 15:09:11 +0000 (16:09 +0100)
src/auth/auth-request-handler.c

index f842191b65d4bc9915fc9a3f4b94ddf089aaec38..a8206f9a955faf2a44f3169b6a8ff4179ef21c3a 100644 (file)
@@ -66,10 +66,22 @@ void auth_request_handler_abort_requests(struct auth_request_handler *handler)
        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)