From 4d708dfd2ce589d19c8e038854367c048fbc798b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 22 Nov 2006 18:57:07 +0000 Subject: r19848: Sync with Samba4 - no top-level unique pointers. (This used to be commit 75515c5fda2d405e4b08413a80ee71139673b18a) --- source3/librpc/gen_ndr/cli_unixinfo.c | 8 ++--- source3/librpc/gen_ndr/cli_unixinfo.h | 4 +-- source3/librpc/gen_ndr/ndr_unixinfo.c | 56 +++++++++++++---------------------- source3/librpc/gen_ndr/unixinfo.h | 4 +-- source3/librpc/idl/unixinfo.idl | 6 ++-- 5 files changed, 31 insertions(+), 47 deletions(-) (limited to 'source3/librpc') diff --git a/source3/librpc/gen_ndr/cli_unixinfo.c b/source3/librpc/gen_ndr/cli_unixinfo.c index 078500a953..0621183b08 100644 --- a/source3/librpc/gen_ndr/cli_unixinfo.c +++ b/source3/librpc/gen_ndr/cli_unixinfo.c @@ -37,7 +37,7 @@ NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid **sid) +NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid *sid) { struct unixinfo_UidToSid r; NTSTATUS status; @@ -62,7 +62,7 @@ NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c } /* Return variables */ - *sid = r.out.sid; + *sid = *r.out.sid; /* Return result */ return r.out.result; @@ -99,7 +99,7 @@ NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid **sid) +NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid *sid) { struct unixinfo_GidToSid r; NTSTATUS status; @@ -124,7 +124,7 @@ NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c } /* Return variables */ - *sid = r.out.sid; + *sid = *r.out.sid; /* Return result */ return r.out.result; diff --git a/source3/librpc/gen_ndr/cli_unixinfo.h b/source3/librpc/gen_ndr/cli_unixinfo.h index 1a1683cb37..dc92283d83 100644 --- a/source3/librpc/gen_ndr/cli_unixinfo.h +++ b/source3/librpc/gen_ndr/cli_unixinfo.h @@ -2,8 +2,8 @@ #ifndef __CLI_UNIXINFO__ #define __CLI_UNIXINFO__ NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *uid); -NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid **sid); +NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid *sid); NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *gid); -NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid **sid); +NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid *sid); NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo **infos); #endif /* __CLI_UNIXINFO__ */ diff --git a/source3/librpc/gen_ndr/ndr_unixinfo.c b/source3/librpc/gen_ndr/ndr_unixinfo.c index bbf76a368b..026a8abc96 100644 --- a/source3/librpc/gen_ndr/ndr_unixinfo.c +++ b/source3/librpc/gen_ndr/ndr_unixinfo.c @@ -128,10 +128,8 @@ NTSTATUS ndr_push_unixinfo_UidToSid(struct ndr_push *ndr, int flags, const struc NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->in.uid)); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.sid)); - if (r->out.sid) { - NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); - } + if (r->out.sid == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NT_STATUS_OK; @@ -139,26 +137,22 @@ NTSTATUS ndr_push_unixinfo_UidToSid(struct ndr_push *ndr, int flags, const struc NTSTATUS ndr_pull_unixinfo_UidToSid(struct ndr_pull *ndr, int flags, struct unixinfo_UidToSid *r) { - uint32_t _ptr_sid; TALLOC_CTX *_mem_save_sid_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->in.uid)); + NDR_PULL_ALLOC(ndr, r->out.sid); + ZERO_STRUCTP(r->out.sid); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sid)); - if (_ptr_sid) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.sid); - } else { - r->out.sid = NULL; - } - if (r->out.sid) { - _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, 0); - NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, 0); } + _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NT_STATUS_OK; @@ -182,9 +176,7 @@ _PUBLIC_ void ndr_print_unixinfo_UidToSid(struct ndr_print *ndr, const char *nam ndr->depth++; ndr_print_ptr(ndr, "sid", r->out.sid); ndr->depth++; - if (r->out.sid) { - ndr_print_dom_sid(ndr, "sid", r->out.sid); - } + ndr_print_dom_sid(ndr, "sid", r->out.sid); ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; @@ -260,10 +252,8 @@ NTSTATUS ndr_push_unixinfo_GidToSid(struct ndr_push *ndr, int flags, const struc NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->in.gid)); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.sid)); - if (r->out.sid) { - NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); - } + if (r->out.sid == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NT_STATUS_OK; @@ -271,26 +261,22 @@ NTSTATUS ndr_push_unixinfo_GidToSid(struct ndr_push *ndr, int flags, const struc NTSTATUS ndr_pull_unixinfo_GidToSid(struct ndr_pull *ndr, int flags, struct unixinfo_GidToSid *r) { - uint32_t _ptr_sid; TALLOC_CTX *_mem_save_sid_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->in.gid)); + NDR_PULL_ALLOC(ndr, r->out.sid); + ZERO_STRUCTP(r->out.sid); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sid)); - if (_ptr_sid) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.sid); - } else { - r->out.sid = NULL; - } - if (r->out.sid) { - _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, 0); - NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, 0); } + _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NT_STATUS_OK; @@ -314,9 +300,7 @@ _PUBLIC_ void ndr_print_unixinfo_GidToSid(struct ndr_print *ndr, const char *nam ndr->depth++; ndr_print_ptr(ndr, "sid", r->out.sid); ndr->depth++; - if (r->out.sid) { - ndr_print_dom_sid(ndr, "sid", r->out.sid); - } + ndr_print_dom_sid(ndr, "sid", r->out.sid); ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; diff --git a/source3/librpc/gen_ndr/unixinfo.h b/source3/librpc/gen_ndr/unixinfo.h index 8ebadc796b..61747aeb9d 100644 --- a/source3/librpc/gen_ndr/unixinfo.h +++ b/source3/librpc/gen_ndr/unixinfo.h @@ -30,7 +30,7 @@ struct unixinfo_UidToSid { } in; struct { - struct dom_sid *sid;/* [unique] */ + struct dom_sid *sid;/* [ref] */ NTSTATUS result; } out; @@ -56,7 +56,7 @@ struct unixinfo_GidToSid { } in; struct { - struct dom_sid *sid;/* [unique] */ + struct dom_sid *sid;/* [ref] */ NTSTATUS result; } out; diff --git a/source3/librpc/idl/unixinfo.idl b/source3/librpc/idl/unixinfo.idl index c674329e52..93cd06fc18 100644 --- a/source3/librpc/idl/unixinfo.idl +++ b/source3/librpc/idl/unixinfo.idl @@ -16,14 +16,14 @@ import "security.idl"; /* Function: 0x00 */ NTSTATUS unixinfo_SidToUid ( [in] dom_sid sid, - [out,ref] hyper *uid + [out] hyper *uid ); /******************/ /* Function: 0x01 */ NTSTATUS unixinfo_UidToSid ( [in] hyper uid, - [out,unique] dom_sid *sid + [out] dom_sid *sid ); /******************/ @@ -37,7 +37,7 @@ import "security.idl"; /* Function: 0x03 */ NTSTATUS unixinfo_GidToSid ( [in] hyper gid, - [out,unique] dom_sid *sid + [out] dom_sid *sid ); typedef struct { -- cgit