]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: master-login-auth - Fix auth lookup privilege problem when imap process...
authorSina Tavakoli <sina.tavakoli@open-xchange.com>
Wed, 8 Jan 2020 11:10:34 +0000 (13:10 +0200)
committerSina Tavakoli <sina.tavakoli@open-xchange.com>
Thu, 9 Jan 2020 12:20:21 +0000 (14:20 +0200)
src/lib-master/master-login-auth.c
src/master/test-master-login-auth.c

index add21bfd6d4e7767ee0310003bffd3b48edea031..f9177251f69e2f8b05196aa95a072cbc25fb66d3 100644 (file)
@@ -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;
index 51b121f499790bf33f940e59076901533176feb6..40775b2ccfe3317f8f93e5924d87ad917a851064 100644 (file)
@@ -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();