summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2023-01-12 11:51:50 +0100
committerRalph Boehme <slow@samba.org>2023-01-12 15:38:30 +0000
commit3a458a8198eef40e4e58a6dc10525409188d573f (patch)
tree0bb8f9922b1325b4775497032c0300d23107fbb4
parent6dcbea9e0fb09f2d420b2424081bb20d459277fb (diff)
downloadsamba-3a458a8198eef40e4e58a6dc10525409188d573f.tar.gz
lib: Use talloc_asprintf_addbuf() in print_ace_flags()
Simplifies code. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r--source3/lib/util_sd.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/source3/lib/util_sd.c b/source3/lib/util_sd.c
index a4288a46f3d..02e4648e207 100644
--- a/source3/lib/util_sd.c
+++ b/source3/lib/util_sd.c
@@ -241,45 +241,25 @@ static void print_ace_flags(FILE *f, uint8_t flags)
{
char *str = talloc_strdup(NULL, "");
- if (!str) {
- goto out;
- }
-
if (flags & SEC_ACE_FLAG_OBJECT_INHERIT) {
- str = talloc_asprintf(str, "%s%s",
- str, "OI|");
- if (!str) {
- goto out;
- }
+ talloc_asprintf_addbuf(&str, "OI|");
}
if (flags & SEC_ACE_FLAG_CONTAINER_INHERIT) {
- str = talloc_asprintf(str, "%s%s",
- str, "CI|");
- if (!str) {
- goto out;
- }
+ talloc_asprintf_addbuf(&str, "CI|");
}
if (flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT) {
- str = talloc_asprintf(str, "%s%s",
- str, "NP|");
- if (!str) {
- goto out;
- }
+ talloc_asprintf_addbuf(&str, "NP|");
}
if (flags & SEC_ACE_FLAG_INHERIT_ONLY) {
- str = talloc_asprintf(str, "%s%s",
- str, "IO|");
- if (!str) {
- goto out;
- }
+ talloc_asprintf_addbuf(&str, "IO|");
}
if (flags & SEC_ACE_FLAG_INHERITED_ACE) {
- str = talloc_asprintf(str, "%s%s",
- str, "I|");
- if (!str) {
- goto out;
- }
+ talloc_asprintf_addbuf(&str, "I|");
}
+ if (str == NULL) {
+ goto out;
+ }
+
/* Ignore define SEC_ACE_FLAG_SUCCESSFUL_ACCESS ( 0x40 )
and SEC_ACE_FLAG_FAILED_ACCESS ( 0x80 ) as they're
audit ace flags. */