]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth worker client deinit fixes.
authorTimo Sirainen <tss@iki.fi>
Fri, 23 Oct 2009 02:31:06 +0000 (22:31 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 23 Oct 2009 02:31:06 +0000 (22:31 -0400)
--HG--
branch : HEAD

src/auth/auth-worker-client.c
src/auth/main.c

index 4d89719f21bb6d518aeb622a9d14831dbc43a92d..4e69219dd4b992cc7b86a2e89fe50986edf1c929 100644 (file)
@@ -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);
index 8e7c366ccc5f7ce4a3b35acdd8f49db146a56dd6..3209ae136a38310a5cc1ea88453efedb4f6de0f8 100644 (file)
@@ -21,6 +21,8 @@
 #include "auth-master-connection.h"
 #include "auth-client-connection.h"
 
+#include <unistd.h>
+
 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)