summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-10-09 13:53:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:31:16 -0500
commit5de28a07cc3195d13626a3bf4579a565dcf8b9d1 (patch)
tree8e55e4d351df3c25c7c6f5503d22e2cd6058f030
parenta74c3385fc1aa2f408f4b8a0a31d3a3c47164f5c (diff)
downloadsamba-5de28a07cc3195d13626a3bf4579a565dcf8b9d1.tar.gz
samba-5de28a07cc3195d13626a3bf4579a565dcf8b9d1.tar.bz2
samba-5de28a07cc3195d13626a3bf4579a565dcf8b9d1.zip
r25592: Allow to set sec_info for registry security descriptor queries.
Guenther (This used to be commit 09e10d1d2936fd8c841de2a3323a1d0a1f6bd815)
-rw-r--r--source3/utils/net_rpc_registry.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c
index 03a773225e..c43b5334e8 100644
--- a/source3/utils/net_rpc_registry.c
+++ b/source3/utils/net_rpc_registry.c
@@ -991,8 +991,8 @@ static NTSTATUS rpc_registry_getsd_internal(const DOM_SID *domain_sid,
DATA_BLOB blob;
struct security_descriptor sec_desc;
- if (argc != 1) {
- d_printf("Usage: net rpc registry getsd <path>\n");
+ if (argc <1 || argc > 2) {
+ d_printf("Usage: net rpc registry getsd <path> <secinfo>\n");
d_printf("Example: net rpc registry getsd 'HKLM\\Software\\Samba'\n");
return NT_STATUS_OK;
}
@@ -1012,7 +1012,12 @@ static NTSTATUS rpc_registry_getsd_internal(const DOM_SID *domain_sid,
}
sd->size = 0x1000;
- sec_info = SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL;
+
+ if (argc >= 2) {
+ sscanf(argv[1], "%x", &sec_info);
+ } else {
+ sec_info = SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL;
+ }
status = registry_getsd(mem_ctx, pipe_hnd, &pol_key, sec_info, sd);
if (!NT_STATUS_IS_OK(status)) {
@@ -1024,14 +1029,17 @@ static NTSTATUS rpc_registry_getsd_internal(const DOM_SID *domain_sid,
blob.data = sd->data;
blob.length = sd->size;
- ndr_pull_struct_blob(&blob, mem_ctx, &sec_desc,
- (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+ status = ndr_pull_struct_blob(&blob, mem_ctx, &sec_desc,
+ (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto out;
+ }
display_sec_desc(&sec_desc);
out:
- rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_key );
- rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_hive );
+ rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_key);
+ rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_hive);
return status;
}
@@ -1040,7 +1048,7 @@ static NTSTATUS rpc_registry_getsd_internal(const DOM_SID *domain_sid,
static int rpc_registry_getsd(int argc, const char **argv)
{
return run_rpc_command(NULL, PI_WINREG, 0,
- rpc_registry_getsd_internal, argc, argv );
+ rpc_registry_getsd_internal, argc, argv);
}
/********************************************************************