]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Simplify security_descriptor_initialise() with a struct init
authorVolker Lendecke <vl@samba.org>
Tue, 26 Nov 2024 13:42:39 +0000 (14:42 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 3 Dec 2024 08:01:30 +0000 (08:01 +0000)
Rely no the default NULL init.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
libcli/security/security_descriptor.c

index c550d6ed7510e39130c4146037dcb0bf7d0ca5a5..a7159e7da7e66aec4f48810ad693796d36073858 100644 (file)
@@ -34,18 +34,17 @@ struct security_descriptor *security_descriptor_initialise(TALLOC_CTX *mem_ctx)
        if (!sd) {
                return NULL;
        }
+       *sd = (struct security_descriptor){
+               .revision = SD_REVISION,
 
-       sd->revision = SD_REVISION;
-       /* we mark as self relative, even though it isn't while it remains
-          a pointer in memory because this simplifies the ndr code later.
-          All SDs that we store/emit are in fact SELF_RELATIVE
-       */
-       sd->type = SEC_DESC_SELF_RELATIVE;
-
-       sd->owner_sid = NULL;
-       sd->group_sid = NULL;
-       sd->sacl = NULL;
-       sd->dacl = NULL;
+               /*
+                * we mark as self relative, even though it isn't
+                * while it remains a pointer in memory because this
+                * simplifies the ndr code later.  All SDs that we
+                * store/emit are in fact SELF_RELATIVE
+                */
+               .type = SEC_DESC_SELF_RELATIVE,
+       };
 
        return sd;
 }