changeset 8599:812a977d7c1a HEAD

auth worker processes shouldn't duplicate the auth cache.
author Timo Sirainen <tss@iki.fi>
date Thu, 08 Jan 2009 11:41:30 -0500
parents 2778cd717f22
children 7c12e20f1eee
files src/auth/auth-request.c src/auth/auth.c
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-request.c	Thu Jan 08 11:34:22 2009 -0500
+++ b/src/auth/auth-request.c	Thu Jan 08 11:41:30 2009 -0500
@@ -1055,9 +1055,11 @@
 		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);
--- a/src/auth/auth.c	Thu Jan 08 11:34:22 2009 -0500
+++ b/src/auth/auth.c	Thu Jan 08 11:41:30 2009 -0500
@@ -199,7 +199,9 @@
 		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);