]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login-common: Reload client settings before proxying
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 31 Jul 2025 06:27:58 +0000 (09:27 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 7 Aug 2025 11:47:03 +0000 (14:47 +0300)
This allows expanding settings that need username.

src/login-common/client-common-auth.c

index 3043e1448219098edd12a2ef2d5b022e7cf35cae..3d9d6530bd1069467f9a437c1262606d1eac861f 100644 (file)
@@ -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