From: Stephan Bosch Date: Tue, 10 Oct 2023 00:03:17 +0000 (+0200) Subject: login-common: client-common-auth - Move delayed final reply handling fully to sasl... X-Git-Tag: 2.4.0~2491 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf48e5a65d9d1f98c659c4340d39a4f5d935dbef;p=thirdparty%2Fdovecot%2Fcore.git login-common: client-common-auth - Move delayed final reply handling fully to sasl-server.c --- diff --git a/src/login-common/client-common-auth.c b/src/login-common/client-common-auth.c index 927122296c..2b4ee707ba 100644 --- a/src/login-common/client-common-auth.c +++ b/src/login-common/client-common-auth.c @@ -806,12 +806,8 @@ void client_auth_respond(struct client *client, const char *response) if (!client_does_custom_io(client)) io_remove(&client->io); - /* This has to happen before * handling, otherwise - client can abort failed request. */ - if (client->final_response) { - sasl_server_auth_delayed_final(client); + if (sasl_server_auth_handle_delayed_final(client)) return; - } if (strcmp(response, "*") == 0) { sasl_server_auth_abort(client); return; diff --git a/src/login-common/sasl-server.c b/src/login-common/sasl-server.c index affb3e8bd7..0415c53966 100644 --- a/src/login-common/sasl-server.c +++ b/src/login-common/sasl-server.c @@ -621,11 +621,17 @@ void sasl_server_auth_abort(struct client *client) SASL_SERVER_REPLY_AUTH_ABORTED); } -void sasl_server_auth_delayed_final(struct client *client) +bool sasl_server_auth_handle_delayed_final(struct client *client) { + /* This has to happen before * handling, otherwise + client can abort failed request. */ + if (!client->final_response) + return FALSE; client->final_response = FALSE; client->authenticating = FALSE; client->auth_client_continue_pending = FALSE; call_client_callback(client, client->delayed_final_reply, NULL, client->final_args); + + return TRUE; } diff --git a/src/login-common/sasl-server.h b/src/login-common/sasl-server.h index d73e3f6258..704dde7b72 100644 --- a/src/login-common/sasl-server.h +++ b/src/login-common/sasl-server.h @@ -37,11 +37,12 @@ void sasl_server_auth_begin(struct client *client, const char *mech_name, enum sasl_server_auth_flags flags, const char *initial_resp_base64, sasl_server_callback_t *callback); -void sasl_server_auth_delayed_final(struct client *client); void sasl_server_auth_failed(struct client *client, const char *reason, const char *code) ATTR_NULL(3); /* Called when client asks for SASL authentication to be aborted by sending "*" line. */ void sasl_server_auth_abort(struct client *client); +bool sasl_server_auth_handle_delayed_final(struct client *client); + #endif