summaryrefslogtreecommitdiff
path: root/libcli/security/conditional_ace.c
AgeCommit message (Collapse)AuthorFilesLines
2024-12-17libcli: Align an integer typeVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2024-12-17libcli: Remove the "mem_ctx" argument from pull_integer()Volker Lendecke1-8/+5
Not needed anymore Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2024-12-17libcli: Simplify pull_integer()Volker Lendecke1-11/+9
Use ndr_pull_struct_blob_noalloc, we don't need talloc here. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2024-09-06libsecurity: Simplify struct ace_condition_scriptVolker Lendecke1-26/+28
We only need the stack temporarily, no reason to put it in the struct Signed-off-by: Volker Lendecke <vl@samba.org> Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Sep 6 14:23:58 UTC 2024 on atb-devel-224
2023-12-14libcli/security: don't allow conditional ACE SIDs to have trailing bytesDouglas Bagnall1-0/+2
They should be tightly packed, allowing conditional ACEs to round-trip. Credit to OSS-Fuzz. REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64197 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-27libcli/security: note suboptimality of conditional ACE Contains operatorsDouglas Bagnall1-0/+4
The Contains and Any_of operators could use a sorted comparison like compare_composites_via_sort(), rather than O(n²) nested loops. But that would involve amount of quite fiddly work that I am not starting on now. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Nov 27 23:38:13 UTC 2023 on atb-devel-224
2023-11-27libcli/security: comparability check: claim members are of one typeDouglas Bagnall1-1/+12
We know from the way claims are defined, and from the code that checks sortedness and sets the flag. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-27libcli/security: shift comparability check to shortcut exitsDouglas Bagnall1-24/+23
The ordinary comparison path, using the sorted arrays, already implicitly checks for comparability. We only need this when we're leaving early. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-27libcli/security: add shortcuts for conditional ACE compareDouglas Bagnall1-0/+55
If the number of members does not match in certain ways we can say the sets are not equal without comparing the members. We first need to check for comparability, though, so that we can return an error if things aren't comparable. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-27libcli/security: improve conditional ACE composite comparisonDouglas Bagnall1-42/+331
We had the comparison method wrong. Composites are compared as sets or flabby sets, depending on their origin. Until now we compared them as something a bit like sets, but not quite, in a maximally inefficient way. Claims are always sets, and the left hand side is always a claim, but literal composites on the right hand side can be multi-sets (containing duplicate values). When it comes to comparison, composites are reduced down to sets. To do the comparison we sort each side and compare in order. The fact that either side might ask for case-sensitive comparison (if it is a claim) is an interesting complication. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-27lib/security:CA: tokens_are_comparable() accepts NULL operatorDouglas Bagnall1-2/+4
In some circumstances we are going to know general comparability without having an operator around to use. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-27libcli/security: CA: tokens_are_comparable() considers the obviousDouglas Bagnall1-0/+3
Existing callers already make this check, but we are soon going to use it in contexts that don't. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-27libcli/security: initialise conditional ACE token flagsDouglas Bagnall1-0/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-25libcli/security: Fix code spellingJoseph Sutton1-4/+4
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-25libcli/security: Fix leak on reallocation failure in ↵Joseph Sutton1-6/+8
conditional_ace_encode_binary() Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-25libcli/security: Fix leak on reallocation failure in pull_composite()Joseph Sutton1-6/+9
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-12libcli/security: Initialize conditional ACE tokenJoseph Sutton1-1/+1
If the ‘flags’ member is not initialized, we invoke undefined behaviour when trying to push or evaluate the parsed conditional ACE. One way this issue can manifest is in the mysterious failure of Unicode comparisons owing to the CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE flag being set when it shouldn’t. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-01libcli/security: Conform to Samba’s brace styleJoseph Sutton1-1/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-29libcli/security: fix talloc context for integer values (CID 1545156)Douglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-29libcli/security: conditional ACEs check again for NULL/empty claimsDouglas Bagnall1-0/+9
CID 1545152. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-27libcli/security: Emit error message if program is too largeJoseph Sutton1-0/+4
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-27libcli/security: condtional ACE recursive composites are not supportedDouglas Bagnall1-5/+3
We can't add them via SDDL on Windows, and they aren't useful for claims. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Sep 27 00:41:26 UTC 2023 on atb-devel-224
2023-09-26conditional_aces: Avoid manual parsing for ace_condition_unicodeAndrew Bartlett1-93/+37
A consequence of this is that we remove the confusing "length" from the IDL, as it was the internal UTF8 length, not a wire value. We use null terminated strings internally now. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-09-26conditional_aces: Avoid manual parsing for ace_condition_intAndrew Bartlett1-16/+35
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-09-26libcli/security: Make failure parsing where consumed == -1 clearAndrew Bartlett1-0/+3
This was caught by the next condition, but this is clearer. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-09-26conditional_aces: Avoid manual parsing for ace_condition_bytes, use DATA_BLOBAndrew Bartlett1-24/+38
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-09-26conditional_aces: Avoid manual parsing for ace_condition_sidAndrew Bartlett1-28/+22
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-09-26libcli/security/conditional ACEs: compare composites as setsDouglas Bagnall1-48/+40
... or at least settishly. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-26libcli:security: add code to interpret conditional ACESDouglas Bagnall1-1/+2128
This doesn't actually *do* anything yet, for two reasons: 1. conditional ACEs are not checked in the libcli/security/access_check.c functions (or anywhere else), and will be treated just as they are now, as unknown types. 2. this file isn't mentioned in the wscript, so aren't compiled. We'll get to point 2 first. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-26libcli/security: add stub of conditional ACE code.Douglas Bagnall1-0/+74
This is just the outline of what will come, but first we'll add conditional ACE SDDL decoding in sddl_conditional_ace.c Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>