[PATCH 07/13] s3/net_rpc_printer: replace dup_sec_desc() usage

David Disseldorp ddiss at samba.org
Mon May 26 09:29:57 MDT 2014


Use security_descriptor_copy() instead, which is also provided by
libcli.

Signed-off-by: David Disseldorp <ddiss at samba.org>
---
 source3/utils/net_rpc_printer.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index 3cdac62..f5247b2 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -1643,7 +1643,17 @@ NTSTATUS rpc_printer_migrate_security_internals(struct net_context *c,
 
 		/* copy secdesc (info level 2) */
 		info_dst.info2.devmode = NULL;
-		info_dst.info2.secdesc = dup_sec_desc(mem_ctx, info_src.info3.secdesc);
+		if (info_src.info3.secdesc == NULL) {
+			info_dst.info2.secdesc = NULL;
+		} else {
+			info_dst.info2.secdesc
+				= security_descriptor_copy(mem_ctx,
+							info_src.info3.secdesc);
+			if (info_dst.info2.secdesc == NULL) {
+				nt_status = NT_STATUS_NO_MEMORY;
+				goto done;
+			}
+		}
 
 		if (c->opt_verbose)
 			display_sec_desc(info_dst.info2.secdesc);
-- 
1.8.4.5



More information about the samba-technical mailing list