From: Timo Sirainen Date: Tue, 26 May 2020 22:03:44 +0000 (+0300) Subject: auth: db-oauth2 - db_oauth2_lookup_passwd_grant() - Reorder error handling code flow X-Git-Tag: 2.3.14.rc1~261 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=34f9f3079990ffc4d1a92240e4e789387ca2698c;p=thirdparty%2Fdovecot%2Fcore.git auth: db-oauth2 - db_oauth2_lookup_passwd_grant() - Reorder error handling code flow --- diff --git a/src/auth/db-oauth2.c b/src/auth/db-oauth2.c index f781437038..775673c24f 100644 --- a/src/auth/db-oauth2.c +++ b/src/auth/db-oauth2.c @@ -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); }