svn commit: samba r4167 - in branches/SAMBA_4_0/source: lib/registry librpc/idl torture/rpc

jelmer at samba.org jelmer at samba.org
Mon Dec 13 01:37:19 GMT 2004


Author: jelmer
Date: 2004-12-13 01:37:18 +0000 (Mon, 13 Dec 2004)
New Revision: 4167

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4167

Log:
Fix CreateKey
Support CreateKey in the RPC registry backend

Modified:
   branches/SAMBA_4_0/source/lib/registry/reg_backend_rpc.c
   branches/SAMBA_4_0/source/librpc/idl/winreg.idl
   branches/SAMBA_4_0/source/torture/rpc/winreg.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/registry/reg_backend_rpc.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/reg_backend_rpc.c	2004-12-13 00:45:29 UTC (rev 4166)
+++ branches/SAMBA_4_0/source/lib/registry/reg_backend_rpc.c	2004-12-13 01:37:18 UTC (rev 4167)
@@ -259,7 +259,32 @@
 
 static WERROR rpc_add_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, uint32_t access_mask, SEC_DESC *sec, struct registry_key **key)
 {
-	return WERR_NOT_SUPPORTED;
+	NTSTATUS status;
+	struct winreg_CreateKey r;
+
+	init_winreg_String(&r.in.key, name);
+	init_winreg_String(&r.in.class, NULL);
+
+	r.in.handle = parent->backend_data;
+	r.out.handle = talloc_p(mem_ctx, struct policy_handle);	
+	r.in.options = 0;
+	r.in.access_mask = access_mask;
+	r.in.sec_desc = NULL;
+
+	status = dcerpc_winreg_CreateKey((struct dcerpc_pipe *)(parent->hive->backend_data), mem_ctx, &r);
+
+    if (!NT_STATUS_IS_OK(status)) {
+        DEBUG(1, ("CreateKey failed - %s\n", nt_errstr(status)));
+        return ntstatus_to_werror(status);
+    }
+
+	if (W_ERROR_IS_OK(r.out.result)) {
+		*key = talloc_p(mem_ctx, struct registry_key);
+		(*key)->name = talloc_strdup(*key, name);
+		(*key)->backend_data = r.out.handle;
+	}
+
+	return r.out.result;
 }
 
 static WERROR rpc_query_key(struct registry_key *k)

Modified: branches/SAMBA_4_0/source/librpc/idl/winreg.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/winreg.idl	2004-12-13 00:45:29 UTC (rev 4166)
+++ branches/SAMBA_4_0/source/librpc/idl/winreg.idl	2004-12-13 01:37:18 UTC (rev 4167)
@@ -75,10 +75,9 @@
 		[in,out,ref] policy_handle *handle,
 		[in] winreg_String key,
 		[in] winreg_String class,
-		[in] uint32 reserved,
-		[out] uint32 *unknown,
+		[in] uint32 options,
 		[in] uint32 access_mask,
-		[in,ref] uint32 *sec_info,
+		[in,out,ref] uint32 *action_taken,
 		[in] sec_desc_buf *sec_desc
 	);
 

Modified: branches/SAMBA_4_0/source/torture/rpc/winreg.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/winreg.c	2004-12-13 00:45:29 UTC (rev 4166)
+++ branches/SAMBA_4_0/source/torture/rpc/winreg.c	2004-12-13 01:37:18 UTC (rev 4167)
@@ -67,7 +67,7 @@
 	struct winreg_CreateKey r;
 	struct policy_handle newhandle;
 	NTSTATUS status;
-	uint32_t sec_info = 0;
+	uint32_t action_taken = 0;
 
 	printf("\ntesting CreateKey\n");
 
@@ -75,9 +75,9 @@
 	r.out.handle = &newhandle;
 	init_winreg_String(&r.in.key, name);	
 	init_winreg_String(&r.in.class, class);
-	r.in.reserved = 0x0;
+	r.in.options = 0x0;
 	r.in.access_mask = 0x02000000;
-	r.in.sec_info = &sec_info;
+	r.in.action_taken = r.out.action_taken = &action_taken;
 	r.in.sec_desc = NULL;
 
 	status = dcerpc_winreg_CreateKey(p, mem_ctx, &r);
@@ -710,7 +710,7 @@
 
     if (lp_parm_int(-1, "torture", "dangerous") != 1) {
 		printf("winreg_InitiateShutdown disabled - enable dangerous tests to use\n");
-	
+	} else {
 		ret &= test_InitiateSystemShutdown(p, mem_ctx, "spottyfood", 30);
 		ret &= test_AbortSystemShutdown(p, mem_ctx);
 	}



More information about the samba-cvs mailing list