s3: Allow NULL sd_size in make_sec_desc
authorVolker Lendecke <vl@samba.org>
Sat, 18 Jun 2011 07:55:05 +0000 (09:55 +0200)
committerVolker Lendecke <vlendec@samba.org>
Sat, 18 Jun 2011 20:26:15 +0000 (22:26 +0200)
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sat Jun 18 22:26:15 CEST 2011 on sn-devel-104

libcli/security/secdesc.c

index 5d75f073f44b2c20f866873f22307ec20fe5980d..2c8fbc59ca4b370e922bccbf2f9263daae1ec61d 100644 (file)
@@ -173,7 +173,9 @@ struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
        struct security_descriptor *dst;
        uint32_t offset     = 0;
 
-       *sd_size = 0;
+       if (sd_size != NULL) {
+               *sd_size = 0;
+       }
 
        if(( dst = talloc_zero(ctx, struct security_descriptor)) == NULL)
                return NULL;
@@ -203,6 +205,10 @@ struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
        if(dacl && ((dst->dacl = dup_sec_acl(dst, dacl)) == NULL))
                goto error_exit;
 
+       if (sd_size == NULL) {
+               return dst;
+       }
+
        offset = SEC_DESC_HEADER_SIZE;
 
        /*
@@ -229,7 +235,9 @@ struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
 
 error_exit:
 
-       *sd_size = 0;
+       if (sd_size != NULL) {
+               *sd_size = 0;
+       }
        return NULL;
 }