]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: auth-request - Snapshot the userdb fields upon authentication success.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 27 Jul 2022 21:09:24 +0000 (23:09 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 20 Feb 2023 09:21:45 +0000 (09:21 +0000)
Otherwise, fields added by mechanisms that don't use a passdb lookup (such as
DOVECOT-TOKEN) can be lost upon the subsequent userdb lookup.

src/auth/auth-request.c

index 6d732656cbbe99211904919b37dbdc5d210358e6..c57d133f193aea9f0580e7eefe4f37b26f105ca2 100644 (file)
@@ -180,6 +180,10 @@ void auth_request_success(struct auth_request *request,
 {
        i_assert(request->state == AUTH_REQUEST_STATE_MECH_CONTINUE);
 
+       /* preserve userdb fields set by mechanisms that don't use a passdb */
+       if (request->fields.userdb_reply != NULL)
+               auth_fields_snapshot(request->fields.userdb_reply);
+
        if (!request->set->policy_check_after_auth) {
                struct auth_policy_check_ctx *ctx =
                        p_new(request->pool, struct auth_policy_check_ctx, 1);