svn commit: samba r24637 - in branches/SAMBA_3_2/source/utils: .

obnox at samba.org obnox at samba.org
Thu Aug 23 15:33:26 GMT 2007


Author: obnox
Date: 2007-08-23 15:33:25 +0000 (Thu, 23 Aug 2007)
New Revision: 24637

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

Log:
In order for "net rpc registry" to be able to write to
Samba's own registry, the access mask for opening the
registry for the write operations needs to be
SEC_RIGHTS_MAXIMUM_ALLOWED instead of REG_WRITE: we can
not open e.g. HKLM read write explicitly, since we can
not write to this virtual part of the registry, only
to the subkeys like 'HKLM\Software\Samba\smbconf' that
are stored on disk.

Note that MAXIMUM_ALLOWED is also what windows' regedit
passed to the open calls.

Michael


Modified:
   branches/SAMBA_3_2/source/utils/net_rpc_registry.c


Changeset:
Modified: branches/SAMBA_3_2/source/utils/net_rpc_registry.c
===================================================================
--- branches/SAMBA_3_2/source/utils/net_rpc_registry.c	2007-08-23 14:32:00 UTC (rev 24636)
+++ branches/SAMBA_3_2/source/utils/net_rpc_registry.c	2007-08-23 15:33:25 UTC (rev 24637)
@@ -354,7 +354,8 @@
 	NTSTATUS status;
 	struct registry_value value;
 
-	status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_WRITE,
+	status = registry_openkey(mem_ctx, pipe_hnd, argv[0], 
+				  SEC_RIGHTS_MAXIMUM_ALLOWED,
 				  &hive_hnd, &key_hnd);
 	if (!NT_STATUS_IS_OK(status)) {
 		d_fprintf(stderr, "registry_openkey failed: %s\n",
@@ -423,7 +424,8 @@
 
 	ZERO_STRUCT(valuename);
 
-	status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_WRITE,
+	status = registry_openkey(mem_ctx, pipe_hnd, argv[0],
+				  SEC_RIGHTS_MAXIMUM_ALLOWED,
 				  &hive_hnd, &key_hnd);
 	if (!NT_STATUS_IS_OK(status)) {
 		d_fprintf(stderr, "registry_openkey failed: %s\n",
@@ -481,7 +483,7 @@
 	}
 
 	status = rpccli_winreg_Connect(pipe_hnd, mem_ctx, hive,
-				       REG_KEY_READ|REG_KEY_WRITE,
+				       SEC_RIGHTS_MAXIMUM_ALLOWED,
 				       &hive_hnd);
 	if (!(NT_STATUS_IS_OK(status))) {
 		return status;
@@ -548,7 +550,8 @@
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
-	status = rpccli_winreg_Connect(pipe_hnd, mem_ctx, hive, REG_KEY_WRITE,
+	status = rpccli_winreg_Connect(pipe_hnd, mem_ctx, hive,
+				       SEC_RIGHTS_MAXIMUM_ALLOWED,
 				       &hive_hnd);
 	if (!(NT_STATUS_IS_OK(status))) {
 		return status;



More information about the samba-cvs mailing list