From: Volker Lendecke Date: Thu, 12 Jan 2023 10:51:50 +0000 (+0100) Subject: lib: Use talloc_asprintf_addbuf() in print_ace_flags() X-Git-Tag: talloc-2.4.0~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a458a8198eef40e4e58a6dc10525409188d573f;p=thirdparty%2Fsamba.git lib: Use talloc_asprintf_addbuf() in print_ace_flags() Simplifies code. Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- 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. */