From: Timo Sirainen Date: Fri, 23 Oct 2009 02:31:06 +0000 (-0400) Subject: auth worker client deinit fixes. X-Git-Tag: 2.0.alpha2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4e65040b019c061d242c8bc19bf76009679b8a15;p=thirdparty%2Fdovecot%2Fcore.git auth worker client deinit fixes. --HG-- branch : HEAD --- diff --git a/src/auth/auth-worker-client.c b/src/auth/auth-worker-client.c index 4d89719f21..4e69219dd4 100644 --- a/src/auth/auth-worker-client.c +++ b/src/auth/auth-worker-client.c @@ -627,10 +627,10 @@ void auth_worker_client_unref(struct auth_worker_client **_client) { struct auth_worker_client *client = *_client; - if (--client->refcount > 0) { - *_client = NULL; + *_client = NULL; + + if (--client->refcount > 0) return; - } i_stream_unref(&client->input); o_stream_unref(&client->output); diff --git a/src/auth/main.c b/src/auth/main.c index 8e7c366ccc..3209ae136a 100644 --- a/src/auth/main.c +++ b/src/auth/main.c @@ -21,6 +21,8 @@ #include "auth-master-connection.h" #include "auth-client-connection.h" +#include + enum auth_socket_type { AUTH_SOCKET_UNKNOWN = 0, AUTH_SOCKET_CLIENT, @@ -111,7 +113,12 @@ static void main_deinit(void) static void worker_connected(const struct master_service_connection *conn) { - auth_worker_client_create(auth, conn->fd); + if (worker_client != NULL) { + i_error("Auth workers can handle only a single client"); + (void)close(conn->fd); + return; + } + worker_client = auth_worker_client_create(auth, conn->fd); } static void client_connected(const struct master_service_connection *conn)