From: Timo Sirainen Date: Fri, 18 Nov 2011 13:52:23 +0000 (+0200) Subject: login: Minor potential authentication fix when service_count>1 X-Git-Tag: 2.1.rc1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2aac7ca853f63b62ea79ef8eae9ded83ed6063a5;p=thirdparty%2Fdovecot%2Fcore.git login: Minor potential authentication fix when service_count>1 --- diff --git a/src/login-common/client-common.c b/src/login-common/client-common.c index f3df4e8cdc..dcd0391c65 100644 --- a/src/login-common/client-common.c +++ b/src/login-common/client-common.c @@ -156,11 +156,12 @@ void client_destroy(struct client *client, const char *reason) if (client->ssl_proxy != NULL) ssl_proxy_free(&client->ssl_proxy); client->v.destroy(client); - if (client_unref(&client) && - master_service_get_service_count(master_service) == 1) { + if (client_unref(&client) && initial_service_count == 1) { /* as soon as this connection is done with proxying (or whatever), the process will die. there's no need for - authentication anymore, so close the connection. */ + authentication anymore, so close the connection. + do this only with initial service_count=1, in case there + are other clients with pending authentications */ auth_client_disconnect(auth_client); } login_client_destroyed(); diff --git a/src/login-common/login-common.h b/src/login-common/login-common.h index b062bb1e0e..0a6ac12fe5 100644 --- a/src/login-common/login-common.h +++ b/src/login-common/login-common.h @@ -35,6 +35,7 @@ extern struct master_auth *master_auth; extern bool closing_down; extern struct anvil_client *anvil; extern const char *login_rawlog_dir; +extern unsigned int initial_service_count; extern const struct login_settings *global_login_settings; extern void **global_other_settings; diff --git a/src/login-common/main.c b/src/login-common/main.c index 9ec87994a8..c087be9586 100644 --- a/src/login-common/main.c +++ b/src/login-common/main.c @@ -37,6 +37,7 @@ struct master_auth *master_auth; bool closing_down; struct anvil_client *anvil; const char *login_rawlog_dir = NULL; +unsigned int initial_service_count; const struct login_settings *global_login_settings; void **global_other_settings; @@ -286,6 +287,7 @@ static void main_preinit(bool allow_core_dumps) restrict_access_by_env(NULL, TRUE); if (allow_core_dumps) restrict_access_allow_coredumps(TRUE); + initial_service_count = master_service_get_service_count(master_service); } static void main_init(const char *login_socket)