/* Unix SMB/CIFS implementation. routines for marshalling/unmarshalling lsa pipe Copyright (C) Andrew Tridgell 2003 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" /* parse a openpolicy */ NTSTATUS ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, struct lsa_OpenPolicy *r) { NDR_ALLOC(ndr, r->out.handle); NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.handle)); NDR_CHECK(ndr_pull_status(ndr, &r->out.result)); return NT_STATUS_OK; } /* parse a openpolicy2 */ NTSTATUS ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, struct lsa_OpenPolicy2 *r) { NDR_ALLOC(ndr, r->out.handle); NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.handle)); NDR_CHECK(ndr_pull_status(ndr, &r->out.result)); return NT_STATUS_OK; } /* pull a EnumSids */ NTSTATUS ndr_pull_lsa_EnumSids(struct ndr_pull *ndr, struct lsa_EnumSids *r) { uint32 nptrs, asize, i, ptr; NDR_CHECK(ndr_pull_uint32(ndr, &r->out.num_entries)); NDR_CHECK(ndr_pull_uint32(ndr, &nptrs)); NDR_CHECK(ndr_pull_uint32(ndr, &ptr)); if (!ptr) goto done; NDR_CHECK(ndr_pull_uint32(ndr, &asize)); NDR_ALLOC_N(ndr, r->out.sids, nptrs); for (i=0;iout.sids[i]); } else { r->out.sids[i] = NULL; } } for (i=0;iout.sids[i]) NDR_CHECK(ndr_pull_dom_sid2(ndr, r->out.sids[i])); } done: NDR_CHECK(ndr_pull_status(ndr, &r->out.result)); return NT_STATUS_OK; } /* parser auto-generated by pidl */ static NTSTATUS ndr_push_lsa_QosInfo(struct ndr_push *ndr, struct lsa_QosInfo *r) { struct ndr_push_save len_save1, len_save2, len_save3; ndr_push_save(ndr, &len_save1); NDR_CHECK(ndr_push_align_uint32(ndr)); ndr_push_save(ndr, &len_save2); NDR_CHECK(ndr_push_uint32(ndr, 0)); NDR_CHECK(ndr_push_uint16(ndr, r->impersonation_level)); NDR_CHECK(ndr_push_uint8(ndr, r->context_mode)); NDR_CHECK(ndr_push_uint8(ndr, r->effective_only)); ndr_push_save(ndr, &len_save3); ndr_push_restore(ndr, &len_save2); NDR_CHECK(ndr_push_uint32(ndr, len_save3.offset - len_save1.offset)); ndr_push_restore(ndr, &len_save3); return NT_STATUS_OK; } static NTSTATUS ndr_push_lsa_ObjectAttribute(struct ndr_push *ndr, struct lsa_ObjectAttribute *r) { struct ndr_push_save len_save1, len_save2, len_save3; ndr_push_save(ndr, &len_save1); NDR_CHECK(ndr_push_align_uint32(ndr)); ndr_push_save(ndr, &len_save2); NDR_CHECK(ndr_push_uint32(ndr, 0)); NDR_CHECK(ndr_push_ptr(ndr, r->root_dir)); NDR_CHECK(ndr_push_ptr(ndr, r->object_name)); NDR_CHECK(ndr_push_uint32(ndr, r->attributes)); NDR_CHECK(ndr_push_ptr(ndr, r->sec_desc)); NDR_CHECK(ndr_push_ptr(ndr, r->sec_qos)); if (r->root_dir) { NDR_CHECK(ndr_push_uint8(ndr, *r->root_dir)); } if (r->object_name) { NDR_CHECK(ndr_push_unistr(ndr, r->object_name)); } if (r->sec_desc) { NDR_CHECK(ndr_push_security_descriptor(ndr, r->sec_desc)); } if (r->sec_qos) { NDR_CHECK(ndr_push_lsa_QosInfo(ndr, r->sec_qos)); } ndr_push_save(ndr, &len_save3); ndr_push_restore(ndr, &len_save2); NDR_CHECK(ndr_push_uint32(ndr, len_save3.offset - len_save1.offset)); ndr_push_restore(ndr, &len_save3); return NT_STATUS_OK; } NTSTATUS ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, struct lsa_OpenPolicy *r) { NDR_CHECK(ndr_push_ptr(ndr, r->in.system_name)); if (r->in.system_name) { NDR_CHECK(ndr_push_uint16(ndr, *r->in.system_name)); } NDR_CHECK(ndr_push_lsa_ObjectAttribute(ndr, r->in.attr)); NDR_CHECK(ndr_push_uint32(ndr, r->in.desired_access)); return NT_STATUS_OK; } NTSTATUS ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, struct lsa_OpenPolicy2 *r) { NDR_CHECK(ndr_push_ptr(ndr, r->in.system_name)); if (r->in.system_name) { NDR_CHECK(ndr_push_unistr(ndr, r->in.system_name)); } NDR_CHECK(ndr_push_lsa_ObjectAttribute(ndr, r->in.attr)); NDR_CHECK(ndr_push_uint32(ndr, r->in.desired_access)); return NT_STATUS_OK; } NTSTATUS ndr_push_lsa_EnumSids(struct ndr_push *ndr, struct lsa_EnumSids *r) { NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); NDR_CHECK(ndr_push_uint32(ndr, r->in.start_at)); NDR_CHECK(ndr_push_uint32(ndr, r->in.num_entries)); return NT_STATUS_OK; }