From 9ac5f5c8ce6b82d26ed6efc4632e08182d2fda39 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 17 Jul 2009 13:09:26 +0200 Subject: lsa: fill in lsa_StorePrivateData and lsa_RetrievePrivateData and rerun make samba3-idl. Guenther --- librpc/gen_ndr/cli_lsa.c | 17 ++++- librpc/gen_ndr/cli_lsa.h | 10 ++- librpc/gen_ndr/lsa.h | 13 ++++ librpc/gen_ndr/ndr_lsa.c | 163 +++++++++++++++++++++++++++++++++++++++++++++++ librpc/gen_ndr/srv_lsa.c | 4 ++ librpc/idl/lsa.idl | 14 +++- 6 files changed, 214 insertions(+), 7 deletions(-) diff --git a/librpc/gen_ndr/cli_lsa.c b/librpc/gen_ndr/cli_lsa.c index 93362537b4..04cf38aaf3 100644 --- a/librpc/gen_ndr/cli_lsa.c +++ b/librpc/gen_ndr/cli_lsa.c @@ -1796,12 +1796,18 @@ NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, } NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx) + TALLOC_CTX *mem_ctx, + struct policy_handle *handle /* [in] [ref] */, + struct lsa_String *name /* [in] [ref] */, + struct lsa_DATA_BUF *val /* [in] [unique] */) { struct lsa_StorePrivateData r; NTSTATUS status; /* In parameters */ + r.in.handle = handle; + r.in.name = name; + r.in.val = val; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_StorePrivateData, &r); @@ -1832,12 +1838,18 @@ NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, } NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx) + TALLOC_CTX *mem_ctx, + struct policy_handle *handle /* [in] [ref] */, + struct lsa_String *name /* [in] [ref] */, + struct lsa_DATA_BUF **val /* [in,out] [ref] */) { struct lsa_RetrievePrivateData r; NTSTATUS status; /* In parameters */ + r.in.handle = handle; + r.in.name = name; + r.in.val = val; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_RetrievePrivateData, &r); @@ -1862,6 +1874,7 @@ NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, } /* Return variables */ + *val = *r.out.val; /* Return result */ return r.out.result; diff --git a/librpc/gen_ndr/cli_lsa.h b/librpc/gen_ndr/cli_lsa.h index 8dbd7330b4..10c408528f 100644 --- a/librpc/gen_ndr/cli_lsa.h +++ b/librpc/gen_ndr/cli_lsa.h @@ -214,9 +214,15 @@ NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, struct policy_handle *handle /* [in] [ref] */, struct dom_sid2 *dom_sid /* [in] [ref] */); NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx); + TALLOC_CTX *mem_ctx, + struct policy_handle *handle /* [in] [ref] */, + struct lsa_String *name /* [in] [ref] */, + struct lsa_DATA_BUF *val /* [in] [unique] */); NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx); + TALLOC_CTX *mem_ctx, + struct policy_handle *handle /* [in] [ref] */, + struct lsa_String *name /* [in] [ref] */, + struct lsa_DATA_BUF **val /* [in,out] [ref] */); NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *system_name /* [in] [unique,charset(UTF16)] */, diff --git a/librpc/gen_ndr/lsa.h b/librpc/gen_ndr/lsa.h index 06fa44577e..9ee5fab4c8 100644 --- a/librpc/gen_ndr/lsa.h +++ b/librpc/gen_ndr/lsa.h @@ -1332,6 +1332,12 @@ struct lsa_DeleteTrustedDomain { struct lsa_StorePrivateData { + struct { + struct policy_handle *handle;/* [ref] */ + struct lsa_String *name;/* [ref] */ + struct lsa_DATA_BUF *val;/* [unique] */ + } in; + struct { NTSTATUS result; } out; @@ -1341,6 +1347,13 @@ struct lsa_StorePrivateData { struct lsa_RetrievePrivateData { struct { + struct policy_handle *handle;/* [ref] */ + struct lsa_String *name;/* [ref] */ + struct lsa_DATA_BUF **val;/* [ref] */ + } in; + + struct { + struct lsa_DATA_BUF **val;/* [ref] */ NTSTATUS result; } out; diff --git a/librpc/gen_ndr/ndr_lsa.c b/librpc/gen_ndr/ndr_lsa.c index 2b12bbff90..b8ba679378 100644 --- a/librpc/gen_ndr/ndr_lsa.c +++ b/librpc/gen_ndr/ndr_lsa.c @@ -9225,6 +9225,18 @@ _PUBLIC_ void ndr_print_lsa_DeleteTrustedDomain(struct ndr_print *ndr, const cha static enum ndr_err_code ndr_push_lsa_StorePrivateData(struct ndr_push *ndr, int flags, const struct lsa_StorePrivateData *r) { if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + if (r->in.name == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.val)); + if (r->in.val) { + NDR_CHECK(ndr_push_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.val)); + } } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); @@ -9234,7 +9246,37 @@ static enum ndr_err_code ndr_push_lsa_StorePrivateData(struct ndr_push *ndr, int static enum ndr_err_code ndr_pull_lsa_StorePrivateData(struct ndr_pull *ndr, int flags, struct lsa_StorePrivateData *r) { + uint32_t _ptr_val; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_name_0; + TALLOC_CTX *_mem_save_val_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, 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.name); + } + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_val)); + if (_ptr_val) { + NDR_PULL_ALLOC(ndr, r->in.val); + } else { + r->in.val = NULL; + } + if (r->in.val) { + _mem_save_val_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.val, 0); + NDR_CHECK(ndr_pull_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.val)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_val_0, 0); + } } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); @@ -9252,6 +9294,20 @@ _PUBLIC_ void ndr_print_lsa_StorePrivateData(struct ndr_print *ndr, const char * if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "lsa_StorePrivateData"); 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, "name", r->in.name); + ndr->depth++; + ndr_print_lsa_String(ndr, "name", r->in.name); + ndr->depth--; + ndr_print_ptr(ndr, "val", r->in.val); + ndr->depth++; + if (r->in.val) { + ndr_print_lsa_DATA_BUF(ndr, "val", r->in.val); + } + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { @@ -9266,8 +9322,30 @@ _PUBLIC_ void ndr_print_lsa_StorePrivateData(struct ndr_print *ndr, const char * static enum ndr_err_code ndr_push_lsa_RetrievePrivateData(struct ndr_push *ndr, int flags, const struct lsa_RetrievePrivateData *r) { if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + if (r->in.name == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + if (r->in.val == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->in.val)); + if (*r->in.val) { + NDR_CHECK(ndr_push_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.val)); + } } if (flags & NDR_OUT) { + if (r->out.val == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.val)); + if (*r->out.val) { + NDR_CHECK(ndr_push_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.val)); + } NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -9275,9 +9353,68 @@ static enum ndr_err_code ndr_push_lsa_RetrievePrivateData(struct ndr_push *ndr, static enum ndr_err_code ndr_pull_lsa_RetrievePrivateData(struct ndr_pull *ndr, int flags, struct lsa_RetrievePrivateData *r) { + uint32_t _ptr_val; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_name_0; + TALLOC_CTX *_mem_save_val_0; + TALLOC_CTX *_mem_save_val_1; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + 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, 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.name); + } + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.val); + } + _mem_save_val_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.val, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_val)); + if (_ptr_val) { + NDR_PULL_ALLOC(ndr, *r->in.val); + } else { + *r->in.val = NULL; + } + if (*r->in.val) { + _mem_save_val_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->in.val, 0); + NDR_CHECK(ndr_pull_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.val)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_val_1, 0); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_val_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.val); + *r->out.val = *r->in.val; } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.val); + } + _mem_save_val_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.val, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_val)); + if (_ptr_val) { + NDR_PULL_ALLOC(ndr, *r->out.val); + } else { + *r->out.val = NULL; + } + if (*r->out.val) { + _mem_save_val_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.val, 0); + NDR_CHECK(ndr_pull_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.val)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_val_1, 0); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_val_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -9293,11 +9430,37 @@ _PUBLIC_ void ndr_print_lsa_RetrievePrivateData(struct ndr_print *ndr, const cha if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "lsa_RetrievePrivateData"); 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, "name", r->in.name); + ndr->depth++; + ndr_print_lsa_String(ndr, "name", r->in.name); + ndr->depth--; + ndr_print_ptr(ndr, "val", r->in.val); + ndr->depth++; + ndr_print_ptr(ndr, "val", *r->in.val); + ndr->depth++; + if (*r->in.val) { + ndr_print_lsa_DATA_BUF(ndr, "val", *r->in.val); + } + ndr->depth--; + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "lsa_RetrievePrivateData"); ndr->depth++; + ndr_print_ptr(ndr, "val", r->out.val); + ndr->depth++; + ndr_print_ptr(ndr, "val", *r->out.val); + ndr->depth++; + if (*r->out.val) { + ndr_print_lsa_DATA_BUF(ndr, "val", *r->out.val); + } + ndr->depth--; + ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; } diff --git a/librpc/gen_ndr/srv_lsa.c b/librpc/gen_ndr/srv_lsa.c index c86d0857f8..f1b4a06d0d 100644 --- a/librpc/gen_ndr/srv_lsa.c +++ b/librpc/gen_ndr/srv_lsa.c @@ -3366,6 +3366,8 @@ static bool api_lsa_RetrievePrivateData(pipes_struct *p) NDR_PRINT_IN_DEBUG(lsa_RetrievePrivateData, r); } + ZERO_STRUCT(r->out); + r->out.val = r->in.val; r->out.result = _lsa_RetrievePrivateData(p, r); if (p->rng_fault_state) { @@ -6810,6 +6812,8 @@ NTSTATUS rpc_lsarpc_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, c case NDR_LSA_RETRIEVEPRIVATEDATA: { struct lsa_RetrievePrivateData *r = (struct lsa_RetrievePrivateData *)_r; + ZERO_STRUCT(r->out); + r->out.val = r->in.val; r->out.result = _lsa_RetrievePrivateData(cli->pipes_struct, r); return NT_STATUS_OK; } diff --git a/librpc/idl/lsa.idl b/librpc/idl/lsa.idl index 3d7077ccac..7f8ed4afe3 100644 --- a/librpc/idl/lsa.idl +++ b/librpc/idl/lsa.idl @@ -935,10 +935,18 @@ import "misc.idl", "security.idl"; ); /* Function: 0x2a */ - [todo] NTSTATUS lsa_StorePrivateData(); - /* Function: 0x2b */ - [todo] NTSTATUS lsa_RetrievePrivateData(); + NTSTATUS lsa_StorePrivateData( + [in] policy_handle *handle, + [in,ref] lsa_String *name, + [in,unique] lsa_DATA_BUF *val + ); + /* Function: 0x2b */ + NTSTATUS lsa_RetrievePrivateData( + [in] policy_handle *handle, + [in,ref] lsa_String *name, + [in,out,ref] lsa_DATA_BUF **val + ); /**********************/ /* Function: 0x2c */ -- cgit