]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: db-oauth2 - db_oauth2_lookup_passwd_grant() - Reorder error handling code flow
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 26 May 2020 22:03:44 +0000 (01:03 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 7 Dec 2020 08:59:28 +0000 (08:59 +0000)
src/auth/db-oauth2.c

index f781437038a4536f3a7c02a4b4ab9d90d980d52f..775673c24f8adc9754960b24fb473e6ccf9ca895 100644 (file)
@@ -749,12 +749,10 @@ db_oauth2_lookup_passwd_grant(struct oauth2_request_result *result,
        else {
                passdb_result = PASSDB_RESULT_INTERNAL_FAILURE;
                error = db_oauth2_field_find(result->fields, "error");
-               if (error != NULL &&
-                   strcmp("invalid_grant", error) == 0) {
-                       passdb_result = PASSDB_RESULT_PASSWORD_MISMATCH;
-               }
                if (error == NULL)
                        error = "OAuth2 server returned failure without error field";
+               else if (strcmp("invalid_grant", error) == 0)
+                       passdb_result = PASSDB_RESULT_PASSWORD_MISMATCH;
        }
        db_oauth2_callback(req, passdb_result, error);
 }