s3/rpc_server/spoolss: replace dup_sec_desc() usage
authorDavid Disseldorp <ddiss@samba.org>
Mon, 26 May 2014 13:48:34 +0000 (15:48 +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>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/rpc_server/spoolss/srv_spoolss_nt.c

index 588aae4eb902c995ffaca9c5b053c554d90b8939..760c924d80f43ab2a75f329d350d9f596cf33390 100644 (file)
@@ -2935,7 +2935,12 @@ static void spoolss_notify_security_desc(struct messaging_context *msg_ctx,
                                         struct spoolss_PrinterInfo2 *pinfo2,
                                         TALLOC_CTX *mem_ctx)
 {
-       data->data.sd.sd = dup_sec_desc(mem_ctx, pinfo2->secdesc);
+       if (pinfo2->secdesc == NULL) {
+               data->data.sd.sd = NULL;
+       } else {
+               data->data.sd.sd = security_descriptor_copy(mem_ctx,
+                                                           pinfo2->secdesc);
+       }
        data->data.sd.sd_size = ndr_size_security_descriptor(data->data.sd.sd,
                                                             0);
 }
@@ -4071,7 +4076,10 @@ static WERROR construct_printer_info2(TALLOC_CTX *mem_ctx,
                /* don't use talloc_steal() here unless you do a deep steal of all
                   the SEC_DESC members */
 
-               r->secdesc      = dup_sec_desc(mem_ctx, info2->secdesc);
+               r->secdesc = security_descriptor_copy(mem_ctx, info2->secdesc);
+               if (r->secdesc == NULL) {
+                       return WERR_NOMEM;
+               }
        }
 
        return WERR_OK;
@@ -4094,8 +4102,10 @@ static WERROR construct_printer_info3(TALLOC_CTX *mem_ctx,
                /* don't use talloc_steal() here unless you do a deep steal of all
                   the SEC_DESC members */
 
-               r->secdesc = dup_sec_desc(mem_ctx, info2->secdesc);
-               W_ERROR_HAVE_NO_MEMORY(r->secdesc);
+               r->secdesc = security_descriptor_copy(mem_ctx, info2->secdesc);
+               if (r->secdesc == NULL) {
+                       return WERR_NOMEM;
+               }
        }
 
        return WERR_OK;