From e4f57feed07a82276363bd7a77682887b542545d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 26 Nov 2024 14:42:39 +0100 Subject: [PATCH] lib: Simplify security_descriptor_initialise() with a struct init Rely no the default NULL init. Signed-off-by: Volker Lendecke Reviewed-by: Douglas Bagnall --- libcli/security/security_descriptor.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/libcli/security/security_descriptor.c b/libcli/security/security_descriptor.c index c550d6ed751..a7159e7da7e 100644 --- a/libcli/security/security_descriptor.c +++ b/libcli/security/security_descriptor.c @@ -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; } -- 2.47.3