From: Nick Porter Date: Wed, 26 Jul 2023 10:02:10 +0000 (+0100) Subject: Add API for querying / manipulating value box secret flag X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7851e952d125ca4ce72a0771300a785d672a4a60;p=thirdparty%2Ffreeradius-server.git Add API for querying / manipulating value box secret flag In anticipation of the flags moving to a structure. --- diff --git a/src/lib/util/value.h b/src/lib/util/value.h index d2b60745f59..da727fca499 100644 --- a/src/lib/util/value.h +++ b/src/lib/util/value.h @@ -954,6 +954,31 @@ int fr_value_box_mark_safe(fr_value_box_t *box, uint16_t safe) void fr_value_box_mark_unsafe(fr_value_box_t *box) CC_HINT(nonnull); +static inline CC_HINT(nonnull, always_inline) +bool fr_value_box_is_secret(fr_value_box_t const *box) +{ + return box->secret; +} + +static inline CC_HINT(nonnull) +bool fr_value_box_contains_secret(fr_value_box_t const *box) +{ + fr_value_box_t const *vb = NULL; + + if (box->secret) return true; + if (box->type == FR_TYPE_GROUP) { + while ((vb = fr_value_box_list_next(&box->vb_group, vb))) { + if (fr_value_box_contains_secret(vb)) return true; + } + } + return false; +} + +static inline CC_HINT(nonnull, always_inline) +void fr_value_box_set_secret(fr_value_box_t *box, bool secret) +{ + box->secret = secret; +} /** @name Assign and manipulate binary-unsafe C strings