# HG changeset patch # User Timo Sirainen # Date 1489617204 -7200 # Node ID 78b6f3032cc6d5b62a4ab8868dc39d72cc1d357a # Parent 58f7612b06586da782e94c31d7af1053bfda1b21 auth: oauth2 - Template expand failure should be an internal error Not the default "password mismatch". Also changed the API to be closer to the other nearby functions. diff -r 58f7612b0658 -r 78b6f3032cc6 src/auth/db-oauth2.c --- a/src/auth/db-oauth2.c Thu Mar 16 00:32:01 2017 +0200 +++ b/src/auth/db-oauth2.c Thu Mar 16 00:33:24 2017 +0200 @@ -344,7 +344,7 @@ return table; } -static int +static bool db_oauth2_template_export(struct db_oauth2_request *req, const char **error_r ATTR_UNUSED) { @@ -359,7 +359,7 @@ unsigned int i, count; if (passdb_template_is_empty(tmpl)) - return 0; + return TRUE; dest = t_str_new(256); args = passdb_template_get_args(tmpl, &count); @@ -380,7 +380,7 @@ auth_request_set_field(req->auth_request, args[i], value, STATIC_PASS_SCHEME); } - return 0; + return TRUE; } static void db_oauth2_fields_merge(struct db_oauth2_request *req, @@ -493,7 +493,7 @@ if (db_oauth2_validate_username(req, &error) && db_oauth2_user_is_enabled(req, &error) && db_oauth2_token_in_scope(req, &error) && - db_oauth2_template_export(req, &error) == 0 && + db_oauth2_template_export(req, &error) && !req->failed) { req->result = PASSDB_RESULT_OK; } else {