]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Don't lose all forward_ fields if the first passdb lookup fails.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 30 May 2017 13:57:45 +0000 (16:57 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 16 Jun 2017 06:16:47 +0000 (09:16 +0300)
src/auth/auth-request.c

index 3d52655f370112337879a0c828955ffaa0f60b65..3c07aba328831a0f19cd291bc82950168208bfa9 100644 (file)
@@ -406,10 +406,13 @@ bool auth_request_import_info(struct auth_request *request,
                request->debug = TRUE;
        else if (strcmp(key, "client_id") == 0)
                request->client_id = p_strdup(request->pool, value);
-       else if (strcmp(key, "forward_fields") == 0)
+       else if (strcmp(key, "forward_fields") == 0) {
                auth_fields_import_prefixed(request->extra_fields,
                                            "forward_", value, 0);
-       else
+               /* make sure the forward_ fields aren't deleted by
+                  auth_fields_rollback() if the first passdb lookup fails. */
+               auth_fields_snapshot(request->extra_fields);
+       } else
                return FALSE;
        /* NOTE: keep in sync with auth_request_export() */
        return TRUE;