]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check for list taint
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 26 Jan 2018 20:42:41 +0000 (13:42 -0700)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 26 Jan 2018 23:26:53 +0000 (16:26 -0700)
src/include/value.h
src/lib/util/value.c

index b8fe6497e2b311bbfae8414edf42771b42b4020e..47e1ecb4c6a43edabd282515beb88631d2455d2d 100644 (file)
@@ -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
  */
index a16e3befd63028aab594febbc7377dfc14b80b3e..5ff6186f41c6069963b7a36091dbcdb62ceca9b2 100644 (file)
@@ -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.