]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Set *err to -2 when the list isn't found in tmp_dcursor_init() (#4571)
authorJames Jones <jejones3141@gmail.com>
Wed, 22 Jun 2022 21:09:20 +0000 (16:09 -0500)
committerGitHub <noreply@github.com>
Wed, 22 Jun 2022 21:09:20 +0000 (16:09 -0500)
This change honors the comments describing how err is handled, and
also means, given tmpl_find_vp()'s use of tmpl_dcursor_init(),
means callers of tmpl_find_vp() can check its return value
rather than having to look at the written vp (e.g. sometimes_return();
see CID #1503995).

src/lib/server/tmpl_dcursor.c

index eeb126265b29b519546f8846a53dbafd7b6286a5..9bdcfdb400425b93af1a0a1a39d4f177ed620d46 100644 (file)
@@ -373,6 +373,7 @@ fr_pair_t *tmpl_dcursor_init(int *err, TALLOC_CTX *ctx, tmpl_dcursor_ctx_t *cc,
                if (!list_head) {
                        fr_strerror_printf("List \"%s\" not available in this context",
                                           fr_table_str_by_value(pair_list_table, tmpl_list(vpt), "<INVALID>"));
+                       if (err) *err = -2;
                        goto error;
                }
                list_ctx = tmpl_list_ctx(request, tmpl_list(vpt));