From 952f450ce320c226e9dbb50b980dc8c0f9679bf4 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 8 Jan 2009 11:41:30 -0500 Subject: [PATCH] auth worker processes shouldn't duplicate the auth cache. --HG-- branch : HEAD --- src/auth/auth-request.c | 8 +++++--- src/auth/auth.c | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/auth/auth-request.c b/src/auth/auth-request.c index 5bdf60d5c7..758e6233cc 100644 --- a/src/auth/auth-request.c +++ b/src/auth/auth-request.c @@ -1055,9 +1055,11 @@ void auth_request_set_field(struct auth_request *request, return; } - if (passdb_cache != NULL && - request->passdb->passdb->cache_key != NULL) { - /* we'll need to get this field stored into cache */ + if ((passdb_cache != NULL && + request->passdb->passdb->cache_key != NULL) || worker) { + /* we'll need to get this field stored into cache, + or we're a worker and we'll need to send this to the main + auth process that can store it in the cache. */ if (request->extra_cache_fields == NULL) { request->extra_cache_fields = auth_stream_reply_init(request->pool); diff --git a/src/auth/auth.c b/src/auth/auth.c index d437b2aa7e..2a0e2ed9d0 100644 --- a/src/auth/auth.c +++ b/src/auth/auth.c @@ -199,7 +199,9 @@ void auth_init(struct auth *auth) passdb_init(passdb); for (userdb = auth->userdbs; userdb != NULL; userdb = userdb->next) userdb_init(userdb); - passdb_cache_init(); + /* caching is handled only by the main auth process */ + if (!worker) + passdb_cache_init(); auth->mech_handshake = str_new(auth->pool, 512); -- 2.47.3