summaryrefslogtreecommitdiff
path: root/source3/librpc/gen_ndr
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 /source3/librpc/gen_ndr
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)
Diffstat (limited to 'source3/librpc/gen_ndr')
-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
7 files changed, 154 insertions, 8 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;