]> 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)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 30 May 2017 13:57:45 +0000 (16:57 +0300)
src/auth/auth-request.c

index b850fe09176eecbe6c264bef4a561998633e4171..38315b1c742540f9693e91b796888b4edcf5994f 100644 (file)
@@ -408,10 +408,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;