From: Sergey Kitov Date: Fri, 1 Mar 2019 08:57:22 +0000 (+0200) Subject: auth: Fix for processing oauth2 responses with 4xx HTTP status. X-Git-Tag: 2.3.6~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d0b9cf0d2a882f369376758ef911f893f89db6fb;p=thirdparty%2Fdovecot%2Fcore.git auth: Fix for processing oauth2 responses with 4xx HTTP status. --- diff --git a/src/auth/db-oauth2.c b/src/auth/db-oauth2.c index 6a5349ffe0..10c9fc3607 100644 --- a/src/auth/db-oauth2.c +++ b/src/auth/db-oauth2.c @@ -600,13 +600,20 @@ db_oauth2_lookup_passwd_grant(struct oauth2_passwd_grant_result *result, { enum passdb_result passdb_result; const char *error; + const struct oauth2_field *f; req->req = NULL; if (!result->valid) { passdb_result = PASSDB_RESULT_INTERNAL_FAILURE; if (result->success) { - error = auth_fields_find(req->fields, "error"); + error = NULL; + array_foreach(result->fields, f) { + if (strcmp(f->name, "error") == 0) { + error = f->value; + break; + } + } if (error != NULL && strcmp("invalid_grant", error) == 0) { passdb_result = PASSDB_RESULT_PASSWORD_MISMATCH;