]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-auth-client, global: auth_client_set_connect_notify() - Change callback to have...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 9 Mar 2026 15:58:34 +0000 (17:58 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 12 Mar 2026 14:59:51 +0000 (14:59 +0000)
src/doveadm/doveadm-auth.c
src/lib-auth-client/auth-client-connection.c
src/lib-auth-client/auth-client.h
src/lib-auth-client/test-auth-client.c
src/login-common/main.c

index 0e904907819ab672df4089d579a702e51a7aa4aa..c88029fcf1ee673dcd5d251bf3762ed52d2e76e4 100644 (file)
@@ -266,7 +266,7 @@ auth_channel_bind_callback(const char *type, void *context,
 }
 
 static void auth_connected(struct auth_client *client,
-                          bool connected, void *context)
+                          const char *connect_error, void *context)
 {
        struct authtest_input *input = context;
        const char *mech = dsasl_client_mech_get_name(input->sasl_mech);
@@ -276,10 +276,10 @@ static void auth_connected(struct auth_client *client,
        string_t *sasl_output_base64;
        const char *error;
 
-       if (!connected) {
+       if (connect_error != NULL) {
                if (doveadm_is_killed())
                        return;
-               i_fatal("Couldn't connect to auth socket");
+               i_fatal("Couldn't connect to auth socket: %s", connect_error);
        }
        if (auth_client_find_mech(client, mech) == NULL)
                i_fatal("SASL mechanism '%s' not supported by server", mech);
index 500d1fec7c4fa5d7cf99ec9417870f63352b58db..bbfb629e6a8d6dde5aa416793c8af47534078a83 100644 (file)
@@ -215,7 +215,7 @@ static void auth_client_connection_handshake_ready(struct connection *_conn)
 
        timeout_remove(&conn->to);
        if (conn->client->connect_notify_callback != NULL) {
-               conn->client->connect_notify_callback(conn->client, TRUE,
+               conn->client->connect_notify_callback(conn->client, NULL,
                                conn->client->connect_notify_context);
        }
 }
@@ -430,7 +430,7 @@ void auth_client_connection_disconnect(struct auth_client_connection *conn,
        auth_client_connection_remove_requests(conn, reason);
 
        if (conn->client->connect_notify_callback != NULL) {
-               conn->client->connect_notify_callback(conn->client, FALSE,
+               conn->client->connect_notify_callback(conn->client, reason,
                                conn->client->connect_notify_context);
        }
 }
index b9ba31fc7931431cbc52a246bab4bccfdfda5c1d..a1599e56b528c7082e4277c0c34e5ebfb9c4324e 100644 (file)
@@ -78,8 +78,10 @@ typedef int auth_channel_binding_callback_t(const char *type, void *context,
                                            const buffer_t **data_r,
                                            const char **error_r);
 
+/* Called when auth connection is ready after handshake (error == NULL), or if
+   connection or handshaked failed (error != NULL). */
 typedef void auth_connect_notify_callback_t(struct auth_client *client,
-                                           bool connected, void *context);
+                                           const char *error, void *context);
 
 /* Create new authentication client. */
 struct auth_client *
index 2dc5f5ee061f495758925fc662fdebc7173975e3..277d451fd669432695b28c083672ef2a487ec765 100644 (file)
@@ -916,14 +916,14 @@ test_client_auth_callback(struct auth_client_request *request,
 
 static void
 test_client_auth_connected(struct auth_client *client ATTR_UNUSED,
-                          bool connected, void *context)
+                          const char *error, void *context)
 {
        struct login_test *login_test = context;
 
        if (to_client_progress != NULL)
                timeout_reset(to_client_progress);
 
-       if (login_test->status == 0 && !connected) {
+       if (login_test->status == 0 && error != NULL) {
                i_assert(login_test->error == NULL);
                login_test->error = i_strdup("Connection failed");
                login_test->status = -1;
index 129ab3b4209caee5fe5f34f8a32e3ecd2010ed7f..c09735d7c31015c8f9dd9b7812a7f23e089408fa 100644 (file)
@@ -206,9 +206,9 @@ static const struct master_admin_client_callback admin_callbacks = {
 };
 
 static void auth_connect_notify(struct auth_client *client ATTR_UNUSED,
-                               bool connected, void *context ATTR_UNUSED)
+                               const char *error, void *context ATTR_UNUSED)
 {
-       if (connected) {
+       if (error == NULL) {
                auth_connected_once = TRUE;
                clients_notify_auth_connected();
        } else if (shutting_down)