svn commit: samba r4168 - in branches/SAMBA_4_0/source: librpc/idl rpc_server/winreg torture/rpc

jelmer at samba.org jelmer at samba.org
Mon Dec 13 02:04:34 GMT 2004


Author: jelmer
Date: 2004-12-13 02:04:34 +0000 (Mon, 13 Dec 2004)
New Revision: 4168

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

Log:
Implement QueryValue in the server
IDL for NotifyChangeKeyValue

Modified:
   branches/SAMBA_4_0/source/librpc/idl/winreg.idl
   branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c
   branches/SAMBA_4_0/source/torture/rpc/winreg.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/winreg.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/winreg.idl	2004-12-13 01:37:18 UTC (rev 4167)
+++ branches/SAMBA_4_0/source/librpc/idl/winreg.idl	2004-12-13 02:04:34 UTC (rev 4168)
@@ -181,6 +181,13 @@
 	/******************/
 	/* Function: 0x0e */
 	WERROR winreg_NotifyChangeKeyValue(
+		[in,ref] policy_handle *handle,
+		[in] uint8 watch_subtree,
+		[in] uint32 notify_filter,
+		[in] uint32 unknown,
+		[in] winreg_String string1,
+		[in] winreg_String string2, 
+		[in] uint32 unknown2
 	);
 
 	/******************/

Modified: branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c
===================================================================
--- branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c	2004-12-13 01:37:18 UTC (rev 4167)
+++ branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c	2004-12-13 02:04:34 UTC (rev 4168)
@@ -240,6 +240,11 @@
 static WERROR winreg_GetKeySecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
 		       struct winreg_GetKeySecurity *r)
 {
+	struct dcesrv_handle *h;
+
+	h = dcesrv_handle_fetch(dce_call->conn, r->in.handle, HTYPE_REGKEY);
+	DCESRV_CHECK_HANDLE(h);
+
 	return WERR_NOT_SUPPORTED;
 }
 
@@ -341,7 +346,28 @@
 static WERROR winreg_QueryValue(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
 		       struct winreg_QueryValue *r)
 {
-	return WERR_NOT_SUPPORTED;
+	struct dcesrv_handle *h;
+	struct registry_key *key;
+	struct registry_value *val;
+	WERROR result;
+
+	h = dcesrv_handle_fetch(dce_call->conn, r->in.handle, HTYPE_REGKEY);
+	DCESRV_CHECK_HANDLE(h);
+
+	key = h->data;
+	
+	result = reg_key_get_value_by_name(mem_ctx, key, r->in.value_name.name, &val);
+
+	if (!W_ERROR_IS_OK(result)) { 
+		return result;
+	}
+
+	r->out.type = &val->data_type;
+	r->out.size = r->in.size;
+	r->out.length = &val->data_len;
+	r->out.data = val->data_blk;
+
+	return WERR_OK;
 }
 
 

Modified: branches/SAMBA_4_0/source/torture/rpc/winreg.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/winreg.c	2004-12-13 01:37:18 UTC (rev 4167)
+++ branches/SAMBA_4_0/source/torture/rpc/winreg.c	2004-12-13 02:04:34 UTC (rev 4168)
@@ -60,6 +60,36 @@
 	return True;
 }
 
+static BOOL test_NotifyChangeKeyValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+									  struct policy_handle *handle)
+{
+	struct winreg_NotifyChangeKeyValue r;
+	NTSTATUS status;
+
+	printf("\ntesting NotifyChangeKeyValue\n");
+
+	r.in.handle = handle;
+	r.in.watch_subtree = 1;
+	r.in.notify_filter = 0;
+	r.in.unknown = r.in.unknown2 = 0;
+	init_winreg_String(&r.in.string1, NULL);
+	init_winreg_String(&r.in.string2, NULL);
+
+	status = dcerpc_winreg_NotifyChangeKeyValue(p, mem_ctx, &r);
+	
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("NotifyChangeKeyValue failed - %s\n", nt_errstr(status));
+		return False;
+	}
+
+	if (!W_ERROR_IS_OK(r.out.result)) {
+		printf("NotifyChangeKeyValue failed - %s\n", win_errstr(r.out.result));
+		return False;
+	}
+
+	return True;
+}
+
 static BOOL test_CreateKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 			  struct policy_handle *handle, const char *name, 
 			   const char *class)
@@ -609,6 +639,9 @@
 	}
 
 
+	if (!test_NotifyChangeKeyValue(p, mem_ctx, handle)) {
+	}
+	
 	if (!test_GetKeySecurity(p, mem_ctx, handle)) {
 	}
 



More information about the samba-cvs mailing list