summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-09-27 16:05:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:14:51 -0500
commitb3ec4697ef153aec4ac2fc95ee4781b757a7a9ac (patch)
treeb9cae3270d67ecd16dc5a339d748c126b915a0d1
parent3ae0baefa18dac1d94c7fb0a92816e195c07f2b0 (diff)
downloadsamba-b3ec4697ef153aec4ac2fc95ee4781b757a7a9ac.tar.gz
samba-b3ec4697ef153aec4ac2fc95ee4781b757a7a9ac.tar.bz2
samba-b3ec4697ef153aec4ac2fc95ee4781b757a7a9ac.zip
r18962: * Add IDL for SaveKey() and RestoreKey() and regenerated
* Tested RegSaveKey() using win32 app. Apparently this code has been brokne for a really long time. (This used to be commit 5381dcbde34206462562bdfc7639f488820a5a64)
-rw-r--r--source3/librpc/gen_ndr/cli_winreg.c10
-rw-r--r--source3/librpc/gen_ndr/cli_winreg.h4
-rw-r--r--source3/librpc/gen_ndr/ndr_winreg.c121
-rw-r--r--source3/librpc/gen_ndr/ndr_winreg.h1
-rw-r--r--source3/librpc/gen_ndr/srv_winreg.c4
-rw-r--r--source3/librpc/gen_ndr/srv_winreg.h4
-rw-r--r--source3/librpc/gen_ndr/winreg.h18
-rw-r--r--source3/librpc/idl/winreg.idl13
-rw-r--r--source3/rpc_server/srv_winreg_nt.c76
9 files changed, 201 insertions, 50 deletions
diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c
index 08ec10e00c..373fe0782d 100644
--- a/source3/librpc/gen_ndr/cli_winreg.c
+++ b/source3/librpc/gen_ndr/cli_winreg.c
@@ -572,12 +572,15 @@ NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
return werror_to_ntstatus(r.out.result);
}
-NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags)
{
struct winreg_RestoreKey r;
NTSTATUS status;
/* In parameters */
+ r.in.handle = handle;
+ r.in.filename = filename;
+ r.in.flags = flags;
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r);
@@ -597,12 +600,15 @@ NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
return werror_to_ntstatus(r.out.result);
}
-NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
+NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib)
{
struct winreg_SaveKey r;
NTSTATUS status;
/* In parameters */
+ r.in.handle = handle;
+ r.in.filename = filename;
+ r.in.sec_attrib = sec_attrib;
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r);
diff --git a/source3/librpc/gen_ndr/cli_winreg.h b/source3/librpc/gen_ndr/cli_winreg.h
index e31e266aef..9b799bdbf9 100644
--- a/source3/librpc/gen_ndr/cli_winreg.h
+++ b/source3/librpc/gen_ndr/cli_winreg.h
@@ -20,8 +20,8 @@ NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time);
NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length);
NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
+NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags);
+NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib);
NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd);
NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size);
NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
diff --git a/source3/librpc/gen_ndr/ndr_winreg.c b/source3/librpc/gen_ndr/ndr_winreg.c
index 1a08fdb3d3..27123d3ac2 100644
--- a/source3/librpc/gen_ndr/ndr_winreg.c
+++ b/source3/librpc/gen_ndr/ndr_winreg.c
@@ -335,6 +335,44 @@ _PUBLIC_ void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name
ndr->depth--;
}
+NTSTATUS ndr_push_KeySecurityAttribute(struct ndr_push *ndr, int ndr_flags, const struct KeySecurityAttribute *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->data_size));
+ NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS, &r->sec_data));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->inherit));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_BUFFERS, &r->sec_data));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_KeySecurityAttribute(struct ndr_pull *ndr, int ndr_flags, struct KeySecurityAttribute *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->data_size));
+ NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS, &r->sec_data));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->inherit));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_BUFFERS, &r->sec_data));
+ }
+ return NT_STATUS_OK;
+}
+
+_PUBLIC_ void ndr_print_KeySecurityAttribute(struct ndr_print *ndr, const char *name, const struct KeySecurityAttribute *r)
+{
+ ndr_print_struct(ndr, name, "KeySecurityAttribute");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "data_size", r->data_size);
+ ndr_print_KeySecurityData(ndr, "sec_data", &r->sec_data);
+ ndr_print_uint8(ndr, "inherit", r->inherit);
+ ndr->depth--;
+}
+
NTSTATUS ndr_push_QueryMultipleValue(struct ndr_push *ndr, int ndr_flags, const struct QueryMultipleValue *r)
{
if (ndr_flags & NDR_SCALARS) {
@@ -2594,6 +2632,11 @@ _PUBLIC_ void ndr_print_winreg_ReplaceKey(struct ndr_print *ndr, const char *nam
NTSTATUS ndr_push_winreg_RestoreKey(struct ndr_push *ndr, int flags, const struct winreg_RestoreKey *r)
{
if (flags & NDR_IN) {
+ if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
+ if (r->in.filename == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
@@ -2603,7 +2646,24 @@ NTSTATUS ndr_push_winreg_RestoreKey(struct ndr_push *ndr, int flags, const struc
NTSTATUS ndr_pull_winreg_RestoreKey(struct ndr_pull *ndr, int flags, struct winreg_RestoreKey *r)
{
+ TALLOC_CTX *_mem_save_handle_0;
+ TALLOC_CTX *_mem_save_filename_0;
if (flags & NDR_IN) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.handle);
+ }
+ _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.filename);
+ }
+ _mem_save_filename_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.filename, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_filename_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
@@ -2621,6 +2681,15 @@ _PUBLIC_ void ndr_print_winreg_RestoreKey(struct ndr_print *ndr, const char *nam
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "winreg_RestoreKey");
ndr->depth++;
+ ndr_print_ptr(ndr, "handle", r->in.handle);
+ ndr->depth++;
+ ndr_print_policy_handle(ndr, "handle", r->in.handle);
+ ndr->depth--;
+ ndr_print_ptr(ndr, "filename", r->in.filename);
+ ndr->depth++;
+ ndr_print_winreg_String(ndr, "filename", r->in.filename);
+ ndr->depth--;
+ ndr_print_uint32(ndr, "flags", r->in.flags);
ndr->depth--;
}
if (flags & NDR_OUT) {
@@ -2635,6 +2704,14 @@ _PUBLIC_ void ndr_print_winreg_RestoreKey(struct ndr_print *ndr, const char *nam
NTSTATUS ndr_push_winreg_SaveKey(struct ndr_push *ndr, int flags, const struct winreg_SaveKey *r)
{
if (flags & NDR_IN) {
+ if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
+ if (r->in.filename == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.sec_attrib));
+ if (r->in.sec_attrib) {
+ NDR_CHECK(ndr_push_KeySecurityAttribute(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sec_attrib));
+ }
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
@@ -2644,7 +2721,37 @@ NTSTATUS ndr_push_winreg_SaveKey(struct ndr_push *ndr, int flags, const struct w
NTSTATUS ndr_pull_winreg_SaveKey(struct ndr_pull *ndr, int flags, struct winreg_SaveKey *r)
{
+ uint32_t _ptr_sec_attrib;
+ TALLOC_CTX *_mem_save_handle_0;
+ TALLOC_CTX *_mem_save_filename_0;
+ TALLOC_CTX *_mem_save_sec_attrib_0;
if (flags & NDR_IN) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.handle);
+ }
+ _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.filename);
+ }
+ _mem_save_filename_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.filename, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_filename_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sec_attrib));
+ if (_ptr_sec_attrib) {
+ NDR_PULL_ALLOC(ndr, r->in.sec_attrib);
+ } else {
+ r->in.sec_attrib = NULL;
+ }
+ if (r->in.sec_attrib) {
+ _mem_save_sec_attrib_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.sec_attrib, 0);
+ NDR_CHECK(ndr_pull_KeySecurityAttribute(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sec_attrib));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sec_attrib_0, 0);
+ }
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
@@ -2662,6 +2769,20 @@ _PUBLIC_ void ndr_print_winreg_SaveKey(struct ndr_print *ndr, const char *name,
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "winreg_SaveKey");
ndr->depth++;
+ ndr_print_ptr(ndr, "handle", r->in.handle);
+ ndr->depth++;
+ ndr_print_policy_handle(ndr, "handle", r->in.handle);
+ ndr->depth--;
+ ndr_print_ptr(ndr, "filename", r->in.filename);
+ ndr->depth++;
+ ndr_print_winreg_String(ndr, "filename", r->in.filename);
+ ndr->depth--;
+ ndr_print_ptr(ndr, "sec_attrib", r->in.sec_attrib);
+ ndr->depth++;
+ if (r->in.sec_attrib) {
+ ndr_print_KeySecurityAttribute(ndr, "sec_attrib", r->in.sec_attrib);
+ }
+ ndr->depth--;
ndr->depth--;
}
if (flags & NDR_OUT) {
diff --git a/source3/librpc/gen_ndr/ndr_winreg.h b/source3/librpc/gen_ndr/ndr_winreg.h
index dd2ecf0c19..b214f8c170 100644
--- a/source3/librpc/gen_ndr/ndr_winreg.h
+++ b/source3/librpc/gen_ndr/ndr_winreg.h
@@ -92,6 +92,7 @@ void ndr_print_KeySecurityData(struct ndr_print *ndr, const char *name, const st
void ndr_print_winreg_SecBuf(struct ndr_print *ndr, const char *name, const struct winreg_SecBuf *r);
void ndr_print_winreg_CreateAction(struct ndr_print *ndr, const char *name, enum winreg_CreateAction r);
void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name, const struct winreg_StringBuf *r);
+void ndr_print_KeySecurityAttribute(struct ndr_print *ndr, const char *name, const struct KeySecurityAttribute *r);
void ndr_print_QueryMultipleValue(struct ndr_print *ndr, const char *name, const struct QueryMultipleValue *r);
void ndr_print_winreg_OpenHKCR(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCR *r);
void ndr_print_winreg_OpenHKCU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCU *r);
diff --git a/source3/librpc/gen_ndr/srv_winreg.c b/source3/librpc/gen_ndr/srv_winreg.c
index 82070b95e9..9df4952a5e 100644
--- a/source3/librpc/gen_ndr/srv_winreg.c
+++ b/source3/librpc/gen_ndr/srv_winreg.c
@@ -1217,7 +1217,7 @@ static BOOL api_winreg_RestoreKey(pipes_struct *p)
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r);
- r.out.result = _winreg_RestoreKey(p);
+ r.out.result = _winreg_RestoreKey(p, r.in.handle, r.in.filename, r.in.flags);
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &r);
@@ -1273,7 +1273,7 @@ static BOOL api_winreg_SaveKey(pipes_struct *p)
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r);
- r.out.result = _winreg_SaveKey(p);
+ r.out.result = _winreg_SaveKey(p, r.in.handle, r.in.filename, r.in.sec_attrib);
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &r);
diff --git a/source3/librpc/gen_ndr/srv_winreg.h b/source3/librpc/gen_ndr/srv_winreg.h
index fecc5442d8..b0bffa6954 100644
--- a/source3/librpc/gen_ndr/srv_winreg.h
+++ b/source3/librpc/gen_ndr/srv_winreg.h
@@ -20,8 +20,8 @@ WERROR _winreg_OpenKey(pipes_struct *p, struct policy_handle *parent_handle, str
WERROR _winreg_QueryInfoKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time);
WERROR _winreg_QueryValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length);
WERROR _winreg_ReplaceKey(pipes_struct *p);
-WERROR _winreg_RestoreKey(pipes_struct *p);
-WERROR _winreg_SaveKey(pipes_struct *p);
+WERROR _winreg_RestoreKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags);
+WERROR _winreg_SaveKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib);
WERROR _winreg_SetKeySecurity(pipes_struct *p, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd);
WERROR _winreg_SetValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size);
WERROR _winreg_UnLoadKey(pipes_struct *p);
diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h
index 6fc5f1cc01..cb117cb037 100644
--- a/source3/librpc/gen_ndr/winreg.h
+++ b/source3/librpc/gen_ndr/winreg.h
@@ -53,6 +53,12 @@ struct winreg_StringBuf {
const char *name;/* [unique,length_is(length/2),charset(UTF16),size_is(size/2)] */
};
+struct KeySecurityAttribute {
+ uint32_t data_size;
+ struct KeySecurityData sec_data;
+ uint8_t inherit;
+};
+
struct QueryMultipleValue {
struct winreg_String *name;/* [unique] */
enum winreg_Type type;
@@ -360,6 +366,12 @@ struct winreg_ReplaceKey {
struct winreg_RestoreKey {
struct {
+ struct policy_handle *handle;/* [ref] */
+ struct winreg_String *filename;/* [ref] */
+ uint32_t flags;
+ } in;
+
+ struct {
WERROR result;
} out;
@@ -368,6 +380,12 @@ struct winreg_RestoreKey {
struct winreg_SaveKey {
struct {
+ struct policy_handle *handle;/* [ref] */
+ struct winreg_String *filename;/* [ref] */
+ struct KeySecurityAttribute *sec_attrib;/* [unique] */
+ } in;
+
+ struct {
WERROR result;
} out;
diff --git a/source3/librpc/idl/winreg.idl b/source3/librpc/idl/winreg.idl
index d09a8a3fc9..b3658280be 100644
--- a/source3/librpc/idl/winreg.idl
+++ b/source3/librpc/idl/winreg.idl
@@ -238,11 +238,24 @@
/******************/
/* Function: 0x13 */
WERROR winreg_RestoreKey(
+ [in,ref] policy_handle *handle,
+ [in,ref] winreg_String *filename,
+ [in] uint32 flags
);
/******************/
/* Function: 0x14 */
+
+ typedef struct {
+ uint32 data_size;
+ KeySecurityData sec_data;
+ uint8 inherit;
+ } KeySecurityAttribute;
+
WERROR winreg_SaveKey(
+ [in,ref] policy_handle *handle,
+ [in,ref] winreg_String *filename,
+ [in,unique] KeySecurityAttribute *sec_attrib
);
/******************/
diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c
index c5e4230706..92ea0b3d85 100644
--- a/source3/rpc_server/srv_winreg_nt.c
+++ b/source3/rpc_server/srv_winreg_nt.c
@@ -1,9 +1,8 @@
/*
* Unix SMB/CIFS implementation.
* RPC Pipe client / server routines
- * Copyright (C) Andrew Tridgell 1992-1997.
- * Copyright (C) Jeremy Allison 2001.
- * Copyright (C) Gerald Carter 2002-2005.
+ *
+ * Copyright (C) Gerald Carter 2002-2006.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,10 +27,8 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
-#if 0 /* temporaily disabled */
static struct generic_mapping reg_generic_map =
{ REG_KEY_READ, REG_KEY_WRITE, REG_KEY_EXECUTE, REG_KEY_ALL };
-#endif
/******************************************************************
free() function for REGISTRY_KEY
@@ -761,9 +758,6 @@ WERROR _winreg_AbortSystemShutdown(pipes_struct *p, uint16_t *server)
return (ret == 0) ? WERR_OK : WERR_ACCESS_DENIED;
}
-#if 0 /* This code works but is disabled for now until I
- fix the WinReg IDL file -- jerry */
-
/*******************************************************************
********************************************************************/
@@ -914,26 +908,26 @@ static WERROR restore_registry_key ( REGISTRY_KEY *krecord, const char *fname )
return result;
}
-#endif
-
/*******************************************************************
********************************************************************/
-WERROR _winreg_RestoreKey(pipes_struct *p)
+WERROR _winreg_RestoreKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags)
{
-#if 0 /* temporarily disabled */
- REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol );
- pstring filename;
+ REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, handle );
+ pstring fname;
int snum;
if ( !regkey )
return WERR_BADFID;
- rpcstr_pull(filename, q_u->filename.string->buffer, sizeof(filename), q_u->filename.string->uni_str_len*2, STR_TERMINATE);
+ if ( !filename || !filename->name )
+ return WERR_INVALID_PARAM;
+
+ pstrcpy( fname, filename->name );
- DEBUG(8,("_reg_restore_key: verifying restore of key [%s] from \"%s\"\n", regkey->name, filename));
+ DEBUG(8,("_winreg_RestoreKey: verifying restore of key [%s] from \"%s\"\n", regkey->name, fname));
- if ( (snum = validate_reg_filename( filename )) == -1 )
+ if ( (snum = validate_reg_filename( fname )) == -1 )
return WERR_OBJECT_PATH_INVALID;
/* user must posses SeRestorePrivilege for this this proceed */
@@ -941,17 +935,13 @@ WERROR _winreg_RestoreKey(pipes_struct *p)
if ( !user_has_privileges( p->pipe_user.nt_user_token, &se_restore ) )
return WERR_ACCESS_DENIED;
- DEBUG(2,("_reg_restore_key: Restoring [%s] from %s in share %s\n", regkey->name, filename, lp_servicename(snum) ));
+ DEBUG(2,("_winreg_RestoreKey: Restoring [%s] from %s in share %s\n", regkey->name, fname, lp_servicename(snum) ));
- return restore_registry_key( regkey, filename );
-#endif
+ return restore_registry_key( regkey, fname );
return WERR_NOT_SUPPORTED;
}
-#if 0 /* this code works but has been disable until I fix
- the winreg IDL -- jerry */
-
/********************************************************************
********************************************************************/
@@ -987,14 +977,16 @@ static WERROR reg_write_tree( REGF_FILE *regfile, const char *keypath,
/* we need a REGISTRY_KEY object here to enumerate subkeys and values */
ZERO_STRUCT( registry_key );
- pstrcpy( registry_key.name, keypath );
- if ( !(registry_key.hook = reghook_cache_find( registry_key.name )) )
+
+ if ( (registry_key.name = talloc_strdup(regfile->mem_ctx, keypath)) == NULL )
+ return WERR_NOMEM;
+
+ if ( (registry_key.hook = reghook_cache_find( registry_key.name )) == NULL )
return WERR_BADFILE;
-
/* lookup the values and subkeys */
- if ( !(subkeys = TALLOC_ZERO_P( regfile->mem_ctx, REGSUBKEY_CTR )) )
+ if ( !(subkeys = TALLOC_ZERO_P( regfile->mem_ctx, REGSUBKEY_CTR )) )
return WERR_NOMEM;
if ( !(values = TALLOC_ZERO_P( subkeys, REGVAL_CTR )) )
@@ -1025,6 +1017,7 @@ static WERROR reg_write_tree( REGF_FILE *regfile, const char *keypath,
done:
TALLOC_FREE( subkeys );
+ TALLOC_FREE( registry_key.name );
return result;
}
@@ -1101,35 +1094,32 @@ static WERROR backup_registry_key ( REGISTRY_KEY *krecord, const char *fname )
return result;
}
-#endif
/*******************************************************************
********************************************************************/
-WERROR _winreg_SaveKey(pipes_struct *p)
+WERROR _winreg_SaveKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib)
{
-#if 0
- REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol );
- pstring filename;
+ REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, handle );
+ pstring fname;
int snum;
if ( !regkey )
return WERR_BADFID;
- rpcstr_pull(filename, q_u->filename.string->buffer, sizeof(filename), q_u->filename.string->uni_str_len*2, STR_TERMINATE);
+ if ( !filename || !filename->name )
+ return WERR_INVALID_PARAM;
- DEBUG(8,("_reg_save_key: verifying backup of key [%s] to \"%s\"\n", regkey->name, filename));
+ pstrcpy( fname, filename->name );
+
+ DEBUG(8,("_winreg_SaveKey: verifying backup of key [%s] to \"%s\"\n", regkey->name, fname));
- if ( (snum = validate_reg_filename( filename )) == -1 )
+ if ( (snum = validate_reg_filename( fname )) == -1 )
return WERR_OBJECT_PATH_INVALID;
- DEBUG(2,("_reg_save_key: Saving [%s] to %s in share %s\n", regkey->name, filename, lp_servicename(snum) ));
+ DEBUG(2,("_winreg_SaveKey: Saving [%s] to %s in share %s\n", regkey->name, fname, lp_servicename(snum) ));
- return backup_registry_key( regkey, filename );
-#endif
-
- /* disabled for now until I fix the IDL --jerry */
- return WERR_NOT_SUPPORTED;
+ return backup_registry_key( regkey, fname );
}
/*******************************************************************
@@ -1137,7 +1127,9 @@ WERROR _winreg_SaveKey(pipes_struct *p)
WERROR _winreg_SaveKeyEx(pipes_struct *p)
{
- /* disabled for now until I fix the IDL --jerry */
+ /* fill in your code here if you think this call should
+ do anything */
+
return WERR_NOT_SUPPORTED;
}