From: Sina Tavakoli Date: Wed, 8 Jan 2020 11:10:34 +0000 (+0200) Subject: lib-master: master-login-auth - Fix auth lookup privilege problem when imap process... X-Git-Tag: 2.3.10~166 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecd871b9c8ca7d043af9a0d2e93808cf1083b558;p=thirdparty%2Fdovecot%2Fcore.git lib-master: master-login-auth - Fix auth lookup privilege problem when imap process is reused and user is un-hibernated. --- diff --git a/src/lib-master/master-login-auth.c b/src/lib-master/master-login-auth.c index add21bfd6d..f9177251f6 100644 --- a/src/lib-master/master-login-auth.c +++ b/src/lib-master/master-login-auth.c @@ -97,6 +97,9 @@ static const struct connection_settings master_login_auth_set = { .client = TRUE, }; +static int +master_login_auth_connect(struct master_login_auth *auth); + struct master_login_auth * master_login_auth_init(const char *auth_socket_path, bool request_auth_token) { @@ -125,6 +128,7 @@ master_login_auth_init(const char *auth_socket_path, bool request_auth_token) auth->auth_socket_path); auth->timeout_msecs = 1000 * MASTER_AUTH_LOOKUP_TIMEOUT_SECS; + master_login_auth_connect(auth); return auth; } @@ -505,6 +509,11 @@ master_login_auth_connect(struct master_login_auth *auth) io_loop_time_refresh(); auth->connect_time = ioloop_timeval; auth->connected = TRUE; + + o_stream_nsend_str(auth->conn.output, + t_strdup_printf("VERSION\t%u\t%u\n", + AUTH_MASTER_PROTOCOL_MAJOR_VERSION, + AUTH_MASTER_PROTOCOL_MINOR_VERSION)); return 0; } @@ -577,10 +586,6 @@ void master_login_auth_request(struct master_login_auth *auth, context); return; } - o_stream_nsend_str(auth->conn.output, - t_strdup_printf("VERSION\t%u\t%u\n", - AUTH_MASTER_PROTOCOL_MAJOR_VERSION, - AUTH_MASTER_PROTOCOL_MINOR_VERSION)); } id = ++auth->id_counter; diff --git a/src/master/test-master-login-auth.c b/src/master/test-master-login-auth.c index 51b121f499..40775b2ccf 100644 --- a/src/master/test-master-login-auth.c +++ b/src/master/test-master-login-auth.c @@ -119,7 +119,7 @@ test_client_connection_refused(void) static void test_connection_refused(void) { test_begin("connection refused"); - test_expect_error_string("Connection refused"); + test_expect_error_string_n_times("Connection refused", 2); test_run_client_server(test_client_connection_refused, test_server_connection_refused); test_end();