]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Fixed crash at deinit.
authorTimo Sirainen <tss@iki.fi>
Sun, 14 Mar 2010 13:09:14 +0000 (15:09 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 14 Mar 2010 13:09:14 +0000 (15:09 +0200)
--HG--
branch : HEAD

src/auth/auth.c
src/auth/main.c
src/auth/passdb-cache.h

index 725fc9acfa52dbef80e262e1b0f8958e02efa21d..7c2c4774a1e07d9c84e49c61f50d0a1d77949baa 100644 (file)
@@ -1,19 +1,11 @@
 /* Copyright (c) 2005-2010 Dovecot authors, see the included COPYING file */
 
 #include "auth-common.h"
-#include "network.h"
 #include "array.h"
-#include "str.h"
-#include "env-util.h"
 #include "mech.h"
 #include "userdb.h"
 #include "passdb.h"
-#include "passdb-cache.h"
 #include "auth.h"
-#include "auth-request-handler.h"
-
-#include <stdlib.h>
-#include <unistd.h>
 
 struct auth_userdb_settings userdb_dummy_set = {
        .driver = "static",
@@ -204,10 +196,6 @@ void auth_init(struct auth *auth)
        for (userdb = auth->userdbs; userdb != NULL; userdb = userdb->next)
                userdb_init(userdb->userdb);
 
-       /* caching is handled only by the main auth process */
-       if (!worker)
-               passdb_cache_init(auth->set);
-
        auth_mech_list_verify_passdb(auth);
 }
 
@@ -226,9 +214,6 @@ void auth_deinit(struct auth **_auth)
        for (userdb = auth->userdbs; userdb != NULL; userdb = userdb->next)
                userdb_deinit(userdb->userdb);
 
-       auth_request_handler_deinit();
-       passdb_cache_deinit();
-
        pool_unref(&auth->pool);
 }
 
index fd2f9e97f00e6e5ad1b55995bacdcfe8376cee58..76d06285f43c3e9feb852ed62bccb8ab0851fe91 100644 (file)
@@ -13,6 +13,7 @@
 #include "master-service.h"
 #include "master-interface.h"
 #include "password-scheme.h"
+#include "passdb-cache.h"
 #include "mech.h"
 #include "auth.h"
 #include "auth-penalty.h"
@@ -97,6 +98,9 @@ static void main_init(void)
                /* workers have only a single connection from the master
                   auth process */
                master_service_set_client_limit(master_service, 1);
+       } else {
+               /* caching is handled only by the main auth process */
+               passdb_cache_init(global_auth_settings);
        }
 }
 
@@ -111,9 +115,12 @@ static void main_deinit(void)
        auth_master_connections_deinit();
         auth_worker_server_deinit();
 
-       mech_deinit(global_auth_settings);
        auths_deinit();
+       auth_request_handler_deinit();
+       passdb_cache_deinit();
+
        mech_register_deinit(&mech_reg);
+       mech_deinit(global_auth_settings);
        auth_penalty_deinit(&auth_penalty);
 
        /* allow modules to unregister their dbs/drivers/etc. before freeing
index 98e84ae99a8bade36d2b984f4d4abac1b46b1f26..5b8bbd38a5fc1fc7b576c6b4de749c57d48101cb 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "auth-cache.h"
 
+enum passdb_result;
 extern struct auth_cache *passdb_cache;
 
 bool passdb_cache_verify_plain(struct auth_request *request, const char *key,