s3/profiles: improve copy_registry_tree() errors
authorDavid Disseldorp <ddiss@samba.org>
Tue, 27 May 2014 09:04:11 +0000 (11:04 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 28 May 2014 18:18:21 +0000 (20:18 +0200)
The current error logic doesn't distinguish between a NULL source
security descriptor and ENOMEM.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed May 28 20:18:21 CEST 2014 on sn-devel-104

source3/utils/profiles.c

index a193582387c679bc8a2b6514a104714d1b1c95a2..0f274ad604a2aa94cf2cbcc29ee2f138ea58d9ae 100644 (file)
@@ -130,11 +130,12 @@ static bool copy_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
        /* swap out the SIDs in the security descriptor */
 
        if (nk->sec_desc->sec_desc == NULL) {
        /* swap out the SIDs in the security descriptor */
 
        if (nk->sec_desc->sec_desc == NULL) {
-               new_sd = NULL;
-       } else {
-               new_sd = security_descriptor_copy(outfile->mem_ctx,
-                                                 nk->sec_desc->sec_desc);
+               fprintf(stderr, "Invalid (NULL) security descriptor!\n");
+               return false;
        }
        }
+
+       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;
        if (new_sd == NULL) {
                fprintf(stderr, "Failed to copy security descriptor!\n");
                return False;