]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login: Minor potential authentication fix when service_count>1
authorTimo Sirainen <tss@iki.fi>
Fri, 18 Nov 2011 13:52:23 +0000 (15:52 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 18 Nov 2011 13:52:23 +0000 (15:52 +0200)
src/login-common/client-common.c
src/login-common/login-common.h
src/login-common/main.c

index f3df4e8cdcd3e951e79349e7dec4ef81df523c7f..dcd0391c6528159027cc2991cbc57fd46663003c 100644 (file)
@@ -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();
index b062bb1e0e2c4880564cf44d0a979319dced88cd..0a6ac12fe5b363d73f6fbb3a2342474572a36ffb 100644 (file)
@@ -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;
index 9ec87994a8a9879843deabfb599c10f9bfb87a9f..c087be958649fb376e704a40b59dd343310257c2 100644 (file)
@@ -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)