summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-08-23 15:33:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:12 -0500
commit46f199961fc91b00a19c4132f46c2cb2586e7a8a (patch)
tree3962fc460611576c10eecad5eef61be91d82d606 /source3/utils
parent85d0c15da47ac920b291b8bbfe36e7c12922c5c0 (diff)
downloadsamba-46f199961fc91b00a19c4132f46c2cb2586e7a8a.tar.gz
samba-46f199961fc91b00a19c4132f46c2cb2586e7a8a.tar.bz2
samba-46f199961fc91b00a19c4132f46c2cb2586e7a8a.zip
r24637: 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 (This used to be commit 57c30f7319b35fa452e8a6c585810e55c7e934b2)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_rpc_registry.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c
index 0d54ff3907..459e7f9f85 100644
--- a/source3/utils/net_rpc_registry.c
+++ b/source3/utils/net_rpc_registry.c
@@ -354,7 +354,8 @@ static NTSTATUS rpc_registry_setvalue_internal(const DOM_SID *domain_sid,
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 @@ static NTSTATUS rpc_registry_deletevalue_internal(const DOM_SID *domain_sid,
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 @@ static NTSTATUS rpc_registry_createkey_internal(const DOM_SID *domain_sid,
}
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 @@ static NTSTATUS rpc_registry_deletekey_internal(const DOM_SID *domain_sid,
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;