s3/profiles: replace dup_sec_desc() usage
authorDavid Disseldorp <ddiss@samba.org>
Mon, 26 May 2014 13:41:41 +0000 (15:41 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 28 May 2014 15:52:13 +0000 (17:52 +0200)
Use security_descriptor_copy() instead, which is also provided by
libcli.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/utils/profiles.c

index 442a7de01880d957f972d84f33765db5210d26e9..a193582387c679bc8a2b6514a104714d1b1c95a2 100644 (file)
@@ -129,8 +129,14 @@ static bool copy_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
 
        /* swap out the SIDs in the security descriptor */
 
-       if ( !(new_sd = dup_sec_desc( outfile->mem_ctx, nk->sec_desc->sec_desc )) ) {
-               fprintf( stderr, "Failed to copy security descriptor!\n" );
+       if (nk->sec_desc->sec_desc == NULL) {
+               new_sd = NULL;
+       } else {
+               new_sd = security_descriptor_copy(outfile->mem_ctx,
+                                                 nk->sec_desc->sec_desc);
+       }
+       if (new_sd == NULL) {
+               fprintf(stderr, "Failed to copy security descriptor!\n");
                return False;
        }