diff options
author | Günther Deschner <gd@samba.org> | 2008-01-24 11:44:29 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-01-24 13:54:26 +0100 |
commit | 3b5913810ccb89dedec286b35454ff6b6d4b1cb5 (patch) | |
tree | 2cdb75bbbbae003b4b86c324b403647f711cf5f6 | |
parent | 5695f9b09f2409fd19e1059dbfbbd4a51f33b461 (diff) | |
download | samba-3b5913810ccb89dedec286b35454ff6b6d4b1cb5.tar.gz samba-3b5913810ccb89dedec286b35454ff6b6d4b1cb5.tar.bz2 samba-3b5913810ccb89dedec286b35454ff6b6d4b1cb5.zip |
Fix samr_EnumDomainUsers in samba3, must not be a ref pointer here.
Guenther
(This used to be commit 3b87c5ce4f74f8dd01bfdf8859c6c832da15cd24)
-rw-r--r-- | source3/librpc/gen_ndr/cli_samr.c | 4 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_samr.c | 28 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/samr.h | 2 | ||||
-rw-r--r-- | source3/librpc/idl/samr.idl | 2 |
4 files changed, 22 insertions, 14 deletions
diff --git a/source3/librpc/gen_ndr/cli_samr.c b/source3/librpc/gen_ndr/cli_samr.c index 99e7e45b02..73c123bbdd 100644 --- a/source3/librpc/gen_ndr/cli_samr.c +++ b/source3/librpc/gen_ndr/cli_samr.c @@ -621,7 +621,9 @@ NTSTATUS rpccli_samr_EnumDomainUsers(struct rpc_pipe_client *cli, /* Return variables */ *resume_handle = *r.out.resume_handle; - *sam = *r.out.sam; + if (sam && r.out.sam) { + *sam = *r.out.sam; + } *num_entries = *r.out.num_entries; /* Return result */ diff --git a/source3/librpc/gen_ndr/ndr_samr.c b/source3/librpc/gen_ndr/ndr_samr.c index f407fcf954..ed80da2885 100644 --- a/source3/librpc/gen_ndr/ndr_samr.c +++ b/source3/librpc/gen_ndr/ndr_samr.c @@ -6409,10 +6409,10 @@ static enum ndr_err_code ndr_push_samr_EnumDomainUsers(struct ndr_push *ndr, int return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle)); - if (r->out.sam == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.sam)); + if (r->out.sam) { + NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); } - NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); if (r->out.num_entries == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -6424,6 +6424,7 @@ static enum ndr_err_code ndr_push_samr_EnumDomainUsers(struct ndr_push *ndr, int static enum ndr_err_code ndr_pull_samr_EnumDomainUsers(struct ndr_pull *ndr, int flags, struct samr_EnumDomainUsers *r) { + uint32_t _ptr_sam; TALLOC_CTX *_mem_save_domain_handle_0; TALLOC_CTX *_mem_save_resume_handle_0; TALLOC_CTX *_mem_save_sam_0; @@ -6449,8 +6450,6 @@ static enum ndr_err_code ndr_pull_samr_EnumDomainUsers(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_size)); NDR_PULL_ALLOC(ndr, r->out.resume_handle); *r->out.resume_handle = *r->in.resume_handle; - NDR_PULL_ALLOC(ndr, r->out.sam); - ZERO_STRUCTP(r->out.sam); NDR_PULL_ALLOC(ndr, r->out.num_entries); ZERO_STRUCTP(r->out.num_entries); } @@ -6462,13 +6461,18 @@ static enum ndr_err_code ndr_pull_samr_EnumDomainUsers(struct ndr_pull *ndr, int NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sam)); + if (_ptr_sam) { NDR_PULL_ALLOC(ndr, r->out.sam); + } else { + r->out.sam = NULL; + } + if (r->out.sam) { + _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, 0); + NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, 0); } - _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.num_entries); } @@ -6512,7 +6516,9 @@ _PUBLIC_ void ndr_print_samr_EnumDomainUsers(struct ndr_print *ndr, const char * ndr->depth--; ndr_print_ptr(ndr, "sam", r->out.sam); ndr->depth++; - ndr_print_samr_SamArray(ndr, "sam", r->out.sam); + if (r->out.sam) { + ndr_print_samr_SamArray(ndr, "sam", r->out.sam); + } ndr->depth--; ndr_print_ptr(ndr, "num_entries", r->out.num_entries); ndr->depth++; diff --git a/source3/librpc/gen_ndr/samr.h b/source3/librpc/gen_ndr/samr.h index a512a64380..16e633e47c 100644 --- a/source3/librpc/gen_ndr/samr.h +++ b/source3/librpc/gen_ndr/samr.h @@ -946,7 +946,7 @@ struct samr_EnumDomainUsers { } in; struct { - struct samr_SamArray *sam;/* [ref] */ + struct samr_SamArray *sam;/* [unique] */ uint32_t *num_entries;/* [ref] */ uint32_t *resume_handle;/* [ref] */ NTSTATUS result; diff --git a/source3/librpc/idl/samr.idl b/source3/librpc/idl/samr.idl index baf61c6df3..dbe633f0a5 100644 --- a/source3/librpc/idl/samr.idl +++ b/source3/librpc/idl/samr.idl @@ -349,7 +349,7 @@ import "misc.idl", "lsa.idl", "security.idl"; [in,out,ref] uint32 *resume_handle, [in] samr_AcctFlags acct_flags, [in] uint32 max_size, - [out,ref] samr_SamArray *sam, + [out] samr_SamArray *sam, [out,ref] uint32 *num_entries ); |