dovecot-2.0: lib-master: Fixed errors with post-login scripts.

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 7 14:47:43 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/af7beceda361
changeset: 11110:af7beceda361
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 07 14:47:40 2010 +0300
description:
lib-master: Fixed errors with post-login scripts.

diffstat:

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

diffs (42 lines):

diff -r 3823670df351 -r af7beceda361 src/lib-master/master-login.c
--- a/src/lib-master/master-login.c	Wed Apr 07 14:47:24 2010 +0300
+++ b/src/lib-master/master-login.c	Wed Apr 07 14:47:40 2010 +0300
@@ -337,6 +337,7 @@
 			   void *context)
 {
 	struct master_login_client *client = context;
+	struct master_login_connection *conn = client->conn;
 	struct master_auth_reply reply;
 
 	memset(&reply, 0, sizeof(reply));
@@ -344,21 +345,27 @@
 	reply.status = errormsg == NULL ? MASTER_AUTH_STATUS_OK :
 		MASTER_AUTH_STATUS_INTERNAL_ERROR;
 	reply.mail_pid = getpid();
-	o_stream_send(client->conn->output, &reply, sizeof(reply));
+	o_stream_send(conn->output, &reply, sizeof(reply));
 
 	if (errormsg != NULL || auth_args[0] == NULL) {
 		if (auth_args != NULL) {
 			i_error("login client: Username missing from auth reply");
 			errormsg = MASTER_AUTH_ERRMSG_INTERNAL_FAILURE;
 		}
-		client->conn->login->failure_callback(client, errormsg);
+		conn->login->failure_callback(client, errormsg);
 		master_login_client_free(&client);
 		return;
 	}
 
-	if (client->conn->login->postlogin_socket_path == NULL)
+	if (conn->login->postlogin_socket_path == NULL)
 		master_login_auth_finish(client, auth_args);
 	else {
+		/* we've sent the reply. the connection is no longer needed,
+		   so disconnect it (before login process disconnects us and
+		   logs an error) */
+		master_login_conn_close(conn);
+		master_login_conn_unref(&conn);
+
 		/* execute post-login scripts before finishing auth */
 		if (master_login_postlogin(client, auth_args) < 0)
 			master_login_client_free(&client);


More information about the dovecot-cvs mailing list