/* Unix SMB/CIFS implementation. test suite for lsa rpc lookup operations Copyright (C) Volker Lendecke 2006 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" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_lsa.h" #include "lib/events/events.h" static BOOL open_policy(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct policy_handle **handle) { struct lsa_ObjectAttribute attr; struct lsa_QosInfo qos; struct lsa_OpenPolicy2 r; NTSTATUS status; *handle = talloc(mem_ctx, struct policy_handle); if (!*handle) { return False; } qos.len = 0; qos.impersonation_level = 2; qos.context_mode = 1; qos.effective_only = 0; attr.len = 0; attr.root_dir = NULL; attr.object_name = NULL; attr.attributes = 0; attr.sec_desc = NULL; attr.sec_qos = &qos; r.in.system_name = "\\"; r.in.attr = &attr; r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; r.out.handle = *handle; status = dcerpc_lsa_OpenPolicy2(p, mem_ctx, &r); return NT_STATUS_IS_OK(status); } static BOOL get_domainsid(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, struct policy_handle *handle, struct dom_sid **sid) { struct lsa_QueryInfoPolicy r; NTSTATUS status; r.in.level = LSA_POLICY_INFO_DOMAIN; r.in.handle = handle; status = dcerpc_lsa_QueryInfoPolicy(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) return False; *sid = r.out.info->domain.sid; return True; } static NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, uint16_t level, struct dcerpc_pipe *p, struct policy_handle *handle, struct dom_sid **sids, uint32_t num_sids, struct lsa_TransNameArray *names) { struct lsa_LookupSids r; struct lsa_SidArray sidarray; uint32_t count = 0; uint32_t i; names->count = 0; names->names = NULL; sidarray.num_sids = num_sids; sidarray.sids = talloc_array(mem_ctx, struct lsa_SidPtr, num_sids); for (i=0; i