dovecot-2.0: lib-master: Fixed crashing when using post-login sc...

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 28 15:30:02 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/197d9beec207
changeset: 10813:197d9beec207
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 28 15:28:00 2010 +0200
description:
lib-master: Fixed crashing when using post-login scripts.

diffstat:

 src/lib-master/master-login.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r 156f24de1081 -r 197d9beec207 src/lib-master/master-login.c
--- a/src/lib-master/master-login.c	Sun Feb 28 15:14:32 2010 +0200
+++ b/src/lib-master/master-login.c	Sun Feb 28 15:28:00 2010 +0200
@@ -179,9 +179,6 @@
 
 	login->callback(client, auth_args[0], auth_args+1);
 
-	client->fd = -1;
-	master_login_client_free(&client);
-
 	if (close_sockets) {
 		/* we're dying as soon as this connection closes. */
 		i_assert(master_login_auth_request_count(login->auth) == 0);
@@ -193,6 +190,9 @@
 		/* try stopping again */
 		master_login_stop(login);
 	}
+
+	client->fd = -1;
+	master_login_client_free(&client);
 }
 
 static void master_login_postlogin_free(struct master_login_postlogin *pl)
@@ -409,6 +409,11 @@
 
 	*_conn = NULL;
 
+	if (conn->output == NULL) {
+		/* already deinitialized */
+		return;
+	}
+
 	DLLIST_REMOVE(&conn->login->conns, conn);
 
 	if (conn->io != NULL)
@@ -416,6 +421,7 @@
 	o_stream_unref(&conn->output);
 	if (close(conn->fd) < 0)
 		i_error("close(master login) failed: %m");
+	conn->fd = -1;
 
 	conn->login->service->login_authenticating = FALSE;
 	master_service_io_listeners_add(conn->login->service);


More information about the dovecot-cvs mailing list