]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: db-oauth2 - db_oauth2_template_export() - Make var_expand() error handling...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 26 May 2020 21:36:44 +0000 (00:36 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 7 Dec 2020 08:59:28 +0000 (08:59 +0000)
Other var_expand() errors include the original string in the error message,
so this one should also.

src/auth/db-oauth2.c

index 113249310af74513a9b721a6bf26da5ba2202e1f..511be05a8760d7341c881c50ea8d455d37a68c26 100644 (file)
@@ -433,7 +433,7 @@ db_oauth2_template_export(struct db_oauth2_request *req,
                { NULL, NULL }
        };
        string_t *dest;
-       const char *const *args, *value;
+       const char *const *args, *value, *error;
        struct passdb_template *tmpl = req->db->tmpl;
        unsigned int i, count;
 
@@ -452,7 +452,10 @@ db_oauth2_template_export(struct db_oauth2_request *req,
                                table = db_oauth2_value_get_var_expand_table(req->auth_request,
                                                                             auth_fields_find(req->fields, args[i]));
                        if (var_expand_with_funcs(dest, args[i+1], table, funcs_table,
-                                                 req, error_r) < 0) {
+                                                 req, &error) < 0) {
+                               *error_r = t_strdup_printf(
+                                       "var_expand(%s) failed: %s",
+                                       args[i+1], error);
                                *result_r = PASSDB_RESULT_INTERNAL_FAILURE;
                                return FALSE;
                        }