libcli/security: begin claim_v1_check_and_sort with Boolean checks
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 21 Nov 2023 22:07:29 +0000 (11:07 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 27 Nov 2023 22:37:32 +0000 (22:37 +0000)
commita19f914fb9fd5321cf76b6daa399ef6918d577dc
treef6b9169275b7e9800714e1dcab4c8d5b248637ce
parent4ebb488e512dcaeb1aa1866dd40d2515f9c5da96
libcli/security: begin claim_v1_check_and_sort with Boolean checks

claim_v1_check_and_sort() is meant to sort the claim values and check
that there are no duplicates, as well as making some value checks.

In order to ease into the idea, we look first at the case where the claim
has Boolean values. There are only two values allowed, which limits the
length of a valid claim set and means we only really need to "sort" in
the {1, 0} case, which we rewrite in place as {0, 1}.

That's what will happen with other types: we'll sort in-place, make
some checks on values, set flags, and return an error if there are
duplicates or value errors.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libcli/security/claims-conversions.c
libcli/security/claims-conversions.h