From: Stephan Bosch Date: Fri, 20 Oct 2023 02:41:11 +0000 (+0200) Subject: login-common: sasl-server - Move nologin flag from local variable to client struct X-Git-Tag: 2.4.0~2488 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61e4b4a577c0cdd0b776cb881a0ff6ffba080eca;p=thirdparty%2Fdovecot%2Fcore.git login-common: sasl-server - Move nologin flag from local variable to client struct --- diff --git a/src/login-common/client-common.h b/src/login-common/client-common.h index a1630155a1..017e06f495 100644 --- a/src/login-common/client-common.h +++ b/src/login-common/client-common.h @@ -277,6 +277,7 @@ struct client { bool auth_initializing:1; bool auth_process_comm_fail:1; bool auth_anonymous:1; + bool auth_nologin:1; bool auth_nologin_referral:1; bool proxy_auth_failed:1; bool proxy_noauth:1; diff --git a/src/login-common/sasl-server.c b/src/login-common/sasl-server.c index 6edf6a4cd0..cb0370884a 100644 --- a/src/login-common/sasl-server.c +++ b/src/login-common/sasl-server.c @@ -323,13 +323,12 @@ args_parse_user(struct client *client, const char *key, const char *value) } static void -sasl_server_auth_success_finish(struct client *client, - bool nologin, const char *const *args) +sasl_server_auth_success_finish(struct client *client, const char *const *args) { struct auth_client_request *request = client->auth_request; client->auth_request = NULL; - if (nologin) { + if (client->auth_nologin) { client->authenticating = FALSE; call_client_callback(client, SASL_SERVER_REPLY_SUCCESS, NULL, args); @@ -347,7 +346,6 @@ authenticate_callback(struct auth_client_request *request, { struct client *client = context; unsigned int i; - bool nologin; if (!client->authenticating) { /* client aborted */ @@ -369,7 +367,6 @@ authenticate_callback(struct auth_client_request *request, client->auth_passdb_args = p_strarray_dup(client->pool, args); client->postlogin_socket_path = NULL; - nologin = FALSE; for (i = 0; args[i] != NULL; i++) { const char *key, *value; t_split_key_value_eq(args[i], &key, &value); @@ -383,7 +380,7 @@ authenticate_callback(struct auth_client_request *request, } else if (strcmp(key, "nologin") == 0 || strcmp(key, "proxy") == 0) { /* user can't login */ - nologin = TRUE; + client->auth_nologin = TRUE; } else if (strcmp(key, "anonymous") == 0) { client->auth_anonymous = TRUE; } else if (str_begins(args[i], "event_", &key)) { @@ -391,7 +388,7 @@ authenticate_callback(struct auth_client_request *request, } } - sasl_server_auth_success_finish(client, nologin, args); + sasl_server_auth_success_finish(client, args); break; case AUTH_REQUEST_STATUS_INTERNAL_FAIL: client->auth_process_comm_fail = TRUE; @@ -535,6 +532,7 @@ void sasl_server_auth_begin(struct client *client, const char *mech_name, client->auth_attempts++; client->auth_aborted_by_client = FALSE; + client->auth_nologin = FALSE; client->authenticating = TRUE; client->master_auth_id = 0; if (client->auth_first_started.tv_sec == 0)