From: Stephan Bosch Date: Tue, 10 Oct 2023 00:23:58 +0000 (+0200) Subject: login-common: sasl-server - Split off sasl_server_auth_success_finish() X-Git-Tag: 2.4.0~2489 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ebeb8281edb544dffc3e65e1699977901d9e7f50;p=thirdparty%2Fdovecot%2Fcore.git login-common: sasl-server - Split off sasl_server_auth_success_finish() --- diff --git a/src/login-common/sasl-server.c b/src/login-common/sasl-server.c index 75b82036d4..6edf6a4cd0 100644 --- a/src/login-common/sasl-server.c +++ b/src/login-common/sasl-server.c @@ -322,6 +322,24 @@ args_parse_user(struct client *client, const char *key, const char *value) return TRUE; } +static void +sasl_server_auth_success_finish(struct client *client, + bool nologin, const char *const *args) +{ + struct auth_client_request *request = client->auth_request; + + client->auth_request = NULL; + if (nologin) { + client->authenticating = FALSE; + call_client_callback(client, SASL_SERVER_REPLY_SUCCESS, + NULL, args); + } else if (!sasl_server_check_login(client)) { + i_assert(!client->authenticating); + } else { + anvil_check_too_many_connections(client, request); + } +} + static void authenticate_callback(struct auth_client_request *request, enum auth_request_status status, const char *data_base64, @@ -347,7 +365,6 @@ authenticate_callback(struct auth_client_request *request, break; case AUTH_REQUEST_STATUS_OK: client->master_auth_id = auth_client_request_get_id(request); - client->auth_request = NULL; client->auth_successes++; client->auth_passdb_args = p_strarray_dup(client->pool, args); client->postlogin_socket_path = NULL; @@ -374,15 +391,7 @@ authenticate_callback(struct auth_client_request *request, } } - if (nologin) { - client->authenticating = FALSE; - call_client_callback(client, SASL_SERVER_REPLY_SUCCESS, - NULL, args); - } else if (!sasl_server_check_login(client)) { - i_assert(!client->authenticating); - } else { - anvil_check_too_many_connections(client, request); - } + sasl_server_auth_success_finish(client, nologin, args); break; case AUTH_REQUEST_STATUS_INTERNAL_FAIL: client->auth_process_comm_fail = TRUE;