Mercurial > dovecot > core-2.2
changeset 11110:af7beceda361 HEAD
lib-master: Fixed errors with post-login scripts.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 07 Apr 2010 14:47:40 +0300 |
parents | 3823670df351 |
children | 09ecf24a798b |
files | src/lib-master/master-login.c |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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);