]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Fix for processing oauth2 responses with 4xx HTTP status.
authorSergey Kitov <sergey.kitov@open-xchange.com>
Fri, 1 Mar 2019 08:57:22 +0000 (10:57 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 21 Mar 2019 08:03:03 +0000 (10:03 +0200)
src/auth/db-oauth2.c

index 6a5349ffe08d3f0c4e81ba376affd4b15fcef4ab..10c9fc36076dbc2692707f880a5c70ea6f1e6ed6 100644 (file)
@@ -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;