From: Arran Cudbard-Bell Date: Fri, 26 Jan 2018 20:42:41 +0000 (-0700) Subject: Check for list taint X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=adc329b47b27556b19fafe83704f29678a4e9277;p=thirdparty%2Ffreeradius-server.git Check for list taint --- diff --git a/src/include/value.h b/src/include/value.h index b8fe6497e2b..47e1ecb4c6a 100644 --- a/src/include/value.h +++ b/src/include/value.h @@ -518,6 +518,8 @@ int fr_value_box_list_concat(TALLOC_CTX *ctx, fr_value_box_t *out, fr_value_box_t **list, fr_type_t type, bool free_input); +bool fr_value_box_list_tainted(fr_value_box_t const *head); + /* * Printing */ diff --git a/src/lib/util/value.c b/src/lib/util/value.c index a16e3befd63..5ff6186f41c 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -3661,6 +3661,24 @@ char *fr_value_box_list_asprint(TALLOC_CTX *ctx, fr_value_box_t const *head, cha return aggr; } +/** Check to see if any list members are tainted + * + * @param[in] head of list to check. + * @return + * - true if a list member is tainted. + * - false if no list members are tainted. + */ +bool fr_value_box_list_tainted(fr_value_box_t const *head) +{ + if (!head) return false; + + do { + if (head->tainted) return true; + } while ((head = head->next)); + + return false; +} + /** Concatenate a list of value boxes * * @note Will automatically cast all #fr_value_box_t to type specified.