summaryrefslogtreecommitdiff
path: root/libcli/security
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2023-04-21 15:47:10 +1200
committerAndrew Bartlett <abartlet@samba.org>2023-04-28 02:15:36 +0000
commitfaf1b80a9003b883c77451beaec599777b400eb8 (patch)
treeba2378eafcd2359333f78fe5cf05c09a8a7b5d8c /libcli/security
parent96fe7ebe3f3f17b479daa07be30b52f51797e194 (diff)
downloadsamba-faf1b80a9003b883c77451beaec599777b400eb8.tar.gz
libcli:security: sddl_map_flags rejects trailing nonsense
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'libcli/security')
-rw-r--r--libcli/security/sddl.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/libcli/security/sddl.c b/libcli/security/sddl.c
index cfd625da6ba..b115d893e72 100644
--- a/libcli/security/sddl.c
+++ b/libcli/security/sddl.c
@@ -69,18 +69,14 @@ static bool sddl_map_flags(const struct flag_map *map, const char *str,
*plen = 0;
}
*pflags = 0;
- while (str[0] && isupper(str[0])) {
+ while (str[0] != '\0' && isupper((unsigned char)str[0])) {
size_t len;
uint32_t flags;
bool found;
found = sddl_map_flag(map, str, &len, &flags);
if (!found) {
- if (unknown_flag_is_part_of_next_thing) {
- return true;
- }
- DEBUG(1, ("Unknown flag - %s in %s\n", str, str0));
- return false;
+ break;
}
*pflags |= flags;
@@ -89,7 +85,19 @@ static bool sddl_map_flags(const struct flag_map *map, const char *str,
}
str += len;
}
- return true;
+ /*
+ * For ACL flags, unknown_flag_is_part_of_next_thing is set,
+ * and we expect some more stuff that isn't flags.
+ *
+ * For ACE flags, unknown_flag_is_part_of_next_thing is unset,
+ * and the flags have been tokenised into their own little
+ * string. We don't expect anything here, even whitespace.
+ */
+ if (*str == '\0' || unknown_flag_is_part_of_next_thing) {
+ return true;
+ }
+ DBG_WARNING("Unknown flag - '%s' in '%s'\n", str, str0);
+ return false;
}