dovecot-2.0-sslstream: auth worker client deinit fixes.

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:55:32 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/e519b53b3f87
changeset: 10161:e519b53b3f87
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Oct 22 22:31:06 2009 -0400
description:
auth worker client deinit fixes.

diffstat:

2 files changed, 12 insertions(+), 5 deletions(-)
src/auth/auth-worker-client.c |    8 ++++----
src/auth/main.c               |    9 ++++++++-

diffs (44 lines):

diff -r e027503ddb6b -r e519b53b3f87 src/auth/auth-worker-client.c
--- a/src/auth/auth-worker-client.c	Thu Oct 22 22:25:31 2009 -0400
+++ b/src/auth/auth-worker-client.c	Thu Oct 22 22:31:06 2009 -0400
@@ -627,10 +627,10 @@ void auth_worker_client_unref(struct aut
 {
 	struct auth_worker_client *client = *_client;
 
-	if (--client->refcount > 0) {
-		*_client = NULL;
-		return;
-	}
+	*_client = NULL;
+
+	if (--client->refcount > 0)
+		return;
 
 	i_stream_unref(&client->input);
 	o_stream_unref(&client->output);
diff -r e027503ddb6b -r e519b53b3f87 src/auth/main.c
--- a/src/auth/main.c	Thu Oct 22 22:25:31 2009 -0400
+++ b/src/auth/main.c	Thu Oct 22 22:31:06 2009 -0400
@@ -20,6 +20,8 @@
 #include "auth-worker-client.h"
 #include "auth-master-connection.h"
 #include "auth-client-connection.h"
+
+#include <unistd.h>
 
 enum auth_socket_type {
 	AUTH_SOCKET_UNKNOWN = 0,
@@ -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)


More information about the dovecot-cvs mailing list