From 16bb904d0fd67500b0660f4d7b4e2449e7733b76 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 14 Mar 2010 15:09:14 +0200 Subject: [PATCH] auth: Fixed crash at deinit. --HG-- branch : HEAD --- src/auth/auth.c | 15 --------------- src/auth/main.c | 9 ++++++++- src/auth/passdb-cache.h | 1 + 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/auth/auth.c b/src/auth/auth.c index 725fc9acfa..7c2c4774a1 100644 --- a/src/auth/auth.c +++ b/src/auth/auth.c @@ -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 -#include 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); } diff --git a/src/auth/main.c b/src/auth/main.c index fd2f9e97f0..76d06285f4 100644 --- a/src/auth/main.c +++ b/src/auth/main.c @@ -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 diff --git a/src/auth/passdb-cache.h b/src/auth/passdb-cache.h index 98e84ae99a..5b8bbd38a5 100644 --- a/src/auth/passdb-cache.h +++ b/src/auth/passdb-cache.h @@ -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, -- 2.47.3