From: Aki Tuomi Date: Thu, 31 Jul 2025 06:27:58 +0000 (+0300) Subject: login-common: Reload client settings before proxying X-Git-Tag: 2.4.2~568 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3508e9595be50ab119e4141db3de2636637d664;p=thirdparty%2Fdovecot%2Fcore.git login-common: Reload client settings before proxying This allows expanding settings that need username. --- diff --git a/src/login-common/client-common-auth.c b/src/login-common/client-common-auth.c index 3043e14482..3d9d6530bd 100644 --- a/src/login-common/client-common-auth.c +++ b/src/login-common/client-common-auth.c @@ -745,6 +745,8 @@ static bool client_auth_handle_reply(struct client *client, const struct client_auth_reply *reply, bool success) { + const char *error; + if (array_count(&reply->alt_usernames) > 0) { const char **alt; @@ -755,6 +757,15 @@ client_auth_handle_reply(struct client *client, client->alt_usernames = alt; } + /* Refresh client settings to get mail user variable expanded. */ + if (success && client_settings_reload(client, &error) < 0) { + e_error(client->event, "%s", error); + client_auth_result(client, CLIENT_AUTH_RESULT_TEMPFAIL, reply, + AUTH_TEMP_FAILED_MSG); + client_auth_failed(client); + return TRUE; + } + if (reply->proxy.proxy) { /* we want to proxy the connection to another server. don't do this unless authentication succeeded. with