changeset 21732:78b6f3032cc6

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.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 16 Mar 2017 00:33:24 +0200
parents 58f7612b0658
children 01ffe59436af
files src/auth/db-oauth2.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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 {