From d48f36819fe825de58f1e4feaab14a811ad53421 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 19 Feb 2008 01:19:44 +0100 Subject: Remove unused marshalling for LSA_LOOKUP_SIDS/2/3. This also removes parse_lsa.c entirely. Guenther (This used to be commit f802ba035c95e63c5a6ff9f2fb484d62341cd1a7) --- source3/Makefile.in | 2 +- source3/include/rpc_lsa.h | 164 ----------- source3/rpc_parse/parse_lsa.c | 630 ---------------------------------------- source3/rpc_server/srv_lsa_nt.c | 101 ------- 4 files changed, 1 insertion(+), 896 deletions(-) delete mode 100644 source3/rpc_parse/parse_lsa.c (limited to 'source3') diff --git a/source3/Makefile.in b/source3/Makefile.in index 9da2f580f3..cebe49b510 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -529,7 +529,7 @@ RPC_ECHO_OBJ = rpc_server/srv_echo_nt.o librpc/gen_ndr/srv_echo.o RPC_SERVER_OBJ = @RPC_STATIC@ $(RPC_PIPE_OBJ) -RPC_PARSE_OBJ = rpc_parse/parse_lsa.o $(RPC_PARSE_OBJ2) \ +RPC_PARSE_OBJ = $(RPC_PARSE_OBJ2) \ rpc_parse/parse_spoolss.o \ rpc_parse/parse_eventlog.o rpc_parse/parse_buffer.o \ rpc_parse/parse_ntsvcs.o rpc_parse/parse_svcctl.o $(REGOBJS_OBJ) diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index a92fca817d..cdd21a7515 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -136,173 +136,9 @@ POLICY_LOOKUP_NAMES ) /*******************************************************/ - -/*******************************************************/ - #define MAX_REF_DOMAINS 32 -/* DOM_TRUST_HDR */ -typedef struct dom_trust_hdr -{ - UNIHDR hdr_dom_name; /* referenced domain unicode string headers */ - uint32 ptr_dom_sid; - -} DOM_TRUST_HDR; - -/* DOM_TRUST_INFO */ -typedef struct dom_trust_info -{ - UNISTR2 uni_dom_name; /* domain name unicode string */ - DOM_SID2 ref_dom ; /* referenced domain SID */ - -} DOM_TRUST_INFO; - -/* DOM_R_REF */ -typedef struct dom_ref_info -{ - uint32 num_ref_doms_1; /* num referenced domains */ - uint32 ptr_ref_dom; /* pointer to referenced domains */ - uint32 max_entries; /* 32 - max number of entries */ - uint32 num_ref_doms_2; /* num referenced domains */ - - DOM_TRUST_HDR hdr_ref_dom[MAX_REF_DOMAINS]; /* referenced domains */ - DOM_TRUST_INFO ref_dom [MAX_REF_DOMAINS]; /* referenced domains */ - -} DOM_R_REF; - -/* the domain_idx points to a SID associated with the name */ - -/* LSA_TRANS_NAME - translated name */ -typedef struct lsa_trans_name_info -{ - uint16 sid_name_use; /* value is 5 for a well-known group; 2 for a domain group; 1 for a user... */ - UNIHDR hdr_name; - uint32 domain_idx; /* index into DOM_R_REF array of SIDs */ - -} LSA_TRANS_NAME; - -/* LSA_TRANS_NAME2 - translated name */ -typedef struct lsa_trans_name_info2 -{ - uint16 sid_name_use; /* value is 5 for a well-known group; 2 for a domain group; 1 for a user... */ - UNIHDR hdr_name; - uint32 domain_idx; /* index into DOM_R_REF array of SIDs */ - uint32 unknown; - -} LSA_TRANS_NAME2; - /* This number is based on Win2k and later maximum response allowed */ #define MAX_LOOKUP_SIDS 20480 /* 0x5000 */ -/* LSA_TRANS_NAME_ENUM - LSA Translated Name Enumeration container */ -typedef struct lsa_trans_name_enum_info -{ - uint32 num_entries; - uint32 ptr_trans_names; - uint32 num_entries2; - - LSA_TRANS_NAME *name; /* translated names */ - UNISTR2 *uni_name; - -} LSA_TRANS_NAME_ENUM; - -/* LSA_TRANS_NAME_ENUM2 - LSA Translated Name Enumeration container 2 */ -typedef struct lsa_trans_name_enum_info2 -{ - uint32 num_entries; - uint32 ptr_trans_names; - uint32 num_entries2; - - LSA_TRANS_NAME2 *name; /* translated names */ - UNISTR2 *uni_name; - -} LSA_TRANS_NAME_ENUM2; - -/* LSA_SID_ENUM - LSA SID enumeration container */ -typedef struct lsa_sid_enum_info -{ - uint32 num_entries; - uint32 ptr_sid_enum; - uint32 num_entries2; - - uint32 *ptr_sid; /* domain SID pointers to be looked up. */ - DOM_SID2 *sid; /* domain SIDs to be looked up. */ - -} LSA_SID_ENUM; - -/* LSA_Q_LOOKUP_SIDS - LSA Lookup SIDs */ -typedef struct lsa_q_lookup_sids -{ - POLICY_HND pol; /* policy handle */ - LSA_SID_ENUM sids; - LSA_TRANS_NAME_ENUM names; - uint16 level; - uint32 mapped_count; - -} LSA_Q_LOOKUP_SIDS; - -/* LSA_R_LOOKUP_SIDS - response to LSA Lookup SIDs */ -typedef struct lsa_r_lookup_sids -{ - uint32 ptr_dom_ref; - DOM_R_REF *dom_ref; /* domain reference info */ - - LSA_TRANS_NAME_ENUM names; - uint32 mapped_count; - - NTSTATUS status; /* return code */ - -} LSA_R_LOOKUP_SIDS; - -/* LSA_Q_LOOKUP_SIDS2 - LSA Lookup SIDs 2*/ -typedef struct lsa_q_lookup_sids2 -{ - POLICY_HND pol; /* policy handle */ - LSA_SID_ENUM sids; - LSA_TRANS_NAME_ENUM2 names; - uint16 level; - uint32 mapped_count; - uint32 unknown1; - uint32 unknown2; - -} LSA_Q_LOOKUP_SIDS2; - -/* LSA_R_LOOKUP_SIDS2 - response to LSA Lookup SIDs 2*/ -typedef struct lsa_r_lookup_sids2 -{ - uint32 ptr_dom_ref; - DOM_R_REF *dom_ref; /* domain reference info */ - - LSA_TRANS_NAME_ENUM2 names; - uint32 mapped_count; - - NTSTATUS status; /* return code */ - -} LSA_R_LOOKUP_SIDS2; - -/* LSA_Q_LOOKUP_SIDS3 - LSA Lookup SIDs 3 */ -typedef struct lsa_q_lookup_sids3 -{ - LSA_SID_ENUM sids; - LSA_TRANS_NAME_ENUM2 names; - uint16 level; - uint32 mapped_count; - uint32 unknown1; - uint32 unknown2; - -} LSA_Q_LOOKUP_SIDS3; - -/* LSA_R_LOOKUP_SIDS3 - response to LSA Lookup SIDs 3 */ -typedef struct lsa_r_lookup_sids3 -{ - uint32 ptr_dom_ref; - DOM_R_REF *dom_ref; /* domain reference info */ - - LSA_TRANS_NAME_ENUM2 names; - uint32 mapped_count; - - NTSTATUS status; /* return code */ - -} LSA_R_LOOKUP_SIDS3; - #endif /* _RPC_LSA_H */ diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c deleted file mode 100644 index 81b6fc9e13..0000000000 --- a/source3/rpc_parse/parse_lsa.c +++ /dev/null @@ -1,630 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1997, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, - * Copyright (C) Paul Ashton 1997, - * Copyright (C) Andrew Bartlett 2002, - * Copyright (C) Jim McDonough 2002. - * Copyright (C) Gerald )Jerry) Carter 2005 - * - * 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 3 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, see . - */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_RPC_PARSE - -static bool lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, prs_struct *ps, int depth); -static bool lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn, prs_struct *ps, int depth); - -/******************************************************************* - Inits a LSA_TRANS_NAME structure. -********************************************************************/ - -void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name, - uint16 sid_name_use, const char *name, uint32 idx) -{ - trn->sid_name_use = sid_name_use; - init_unistr2(uni_name, name, UNI_FLAGS_NONE); - init_uni_hdr(&trn->hdr_name, uni_name); - trn->domain_idx = idx; -} - -/******************************************************************* - Reads or writes a LSA_TRANS_NAME structure. -********************************************************************/ - -static bool lsa_io_trans_name(const char *desc, LSA_TRANS_NAME *trn, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_trans_name"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint16("sid_name_use", ps, depth, &trn->sid_name_use)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unihdr ("hdr_name", &trn->hdr_name, ps, depth)) - return False; - if(!prs_uint32("domain_idx ", ps, depth, &trn->domain_idx)) - return False; - - return True; -} - -/******************************************************************* - Inits a LSA_TRANS_NAME2 structure. -********************************************************************/ - -void init_lsa_trans_name2(LSA_TRANS_NAME2 *trn, UNISTR2 *uni_name, - uint16 sid_name_use, const char *name, uint32 idx) -{ - trn->sid_name_use = sid_name_use; - init_unistr2(uni_name, name, UNI_FLAGS_NONE); - init_uni_hdr(&trn->hdr_name, uni_name); - trn->domain_idx = idx; - trn->unknown = 0; -} - -/******************************************************************* - Reads or writes a LSA_TRANS_NAME2 structure. -********************************************************************/ - -static bool lsa_io_trans_name2(const char *desc, LSA_TRANS_NAME2 *trn, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_trans_name2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint16("sid_name_use", ps, depth, &trn->sid_name_use)) - return False; - if(!prs_align(ps)) - return False; - - if(!smb_io_unihdr ("hdr_name", &trn->hdr_name, ps, depth)) - return False; - if(!prs_uint32("domain_idx ", ps, depth, &trn->domain_idx)) - return False; - if(!prs_uint32("unknown ", ps, depth, &trn->unknown)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a DOM_R_REF structure. -********************************************************************/ - -static bool lsa_io_dom_r_ref(const char *desc, DOM_R_REF *dom, prs_struct *ps, int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "lsa_io_dom_r_ref"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_ref_doms_1", ps, depth, &dom->num_ref_doms_1)) /* num referenced domains? */ - return False; - if(!prs_uint32("ptr_ref_dom ", ps, depth, &dom->ptr_ref_dom)) /* undocumented buffer pointer. */ - return False; - if(!prs_uint32("max_entries ", ps, depth, &dom->max_entries)) /* 32 - max number of entries */ - return False; - - SMB_ASSERT_ARRAY(dom->hdr_ref_dom, dom->num_ref_doms_1); - - if (dom->ptr_ref_dom != 0) { - - if(!prs_uint32("num_ref_doms_2", ps, depth, &dom->num_ref_doms_2)) /* 4 - num referenced domains? */ - return False; - - SMB_ASSERT_ARRAY(dom->ref_dom, dom->num_ref_doms_2); - - for (i = 0; i < dom->num_ref_doms_1; i++) { - fstring t; - - slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); - if(!smb_io_unihdr(t, &dom->hdr_ref_dom[i].hdr_dom_name, ps, depth)) - return False; - - slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); - if(!prs_uint32(t, ps, depth, &dom->hdr_ref_dom[i].ptr_dom_sid)) - return False; - } - - for (i = 0; i < dom->num_ref_doms_2; i++) { - fstring t; - - if (dom->hdr_ref_dom[i].hdr_dom_name.buffer != 0) { - slprintf(t, sizeof(t) - 1, "dom_ref[%d] ", i); - if(!smb_io_unistr2(t, &dom->ref_dom[i].uni_dom_name, True, ps, depth)) /* domain name unicode string */ - return False; - if(!prs_align(ps)) - return False; - } - - if (dom->hdr_ref_dom[i].ptr_dom_sid != 0) { - slprintf(t, sizeof(t) - 1, "sid_ptr[%d] ", i); - if(!smb_io_dom_sid2(t, &dom->ref_dom[i].ref_dom, ps, depth)) /* referenced domain SIDs */ - return False; - } - } - } - - return True; -} - -/******************************************************************* - Inits a LSA_SID_ENUM structure. -********************************************************************/ - -static void init_lsa_sid_enum(TALLOC_CTX *mem_ctx, LSA_SID_ENUM *sen, - int num_entries, const DOM_SID *sids) -{ - int i; - - DEBUG(5, ("init_lsa_sid_enum\n")); - - sen->num_entries = num_entries; - sen->ptr_sid_enum = (num_entries != 0); - sen->num_entries2 = num_entries; - - /* Allocate memory for sids and sid pointers */ - - if (num_entries) { - if ((sen->ptr_sid = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_entries )) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for ptr_sid\n")); - return; - } - - if ((sen->sid = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID2, num_entries)) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for sids\n")); - return; - } - } - - /* Copy across SIDs and SID pointers */ - - for (i = 0; i < num_entries; i++) { - sen->ptr_sid[i] = 1; - init_dom_sid2(&sen->sid[i], &sids[i]); - } -} - -/******************************************************************* - Reads or writes a LSA_SID_ENUM structure. -********************************************************************/ - -static bool lsa_io_sid_enum(const char *desc, LSA_SID_ENUM *sen, prs_struct *ps, - int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "lsa_io_sid_enum"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries ", ps, depth, &sen->num_entries)) - return False; - if(!prs_uint32("ptr_sid_enum", ps, depth, &sen->ptr_sid_enum)) - return False; - - /* - if the ptr is NULL, leave here. checked from a real w2k trace. - JFM, 11/23/2001 - */ - - if (sen->ptr_sid_enum==0) - return True; - - if(!prs_uint32("num_entries2", ps, depth, &sen->num_entries2)) - return False; - - /* Mallocate memory if we're unpacking from the wire */ - - if (UNMARSHALLING(ps) && sen->num_entries) { - if ((sen->ptr_sid = PRS_ALLOC_MEM( ps, uint32, sen->num_entries)) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for " - "ptr_sid\n")); - return False; - } - - if ((sen->sid = PRS_ALLOC_MEM( ps, DOM_SID2, sen->num_entries)) == NULL) { - DEBUG(3, ("init_lsa_sid_enum(): out of memory for " - "sids\n")); - return False; - } - } - - for (i = 0; i < sen->num_entries; i++) { - fstring temp; - - slprintf(temp, sizeof(temp) - 1, "ptr_sid[%d]", i); - if(!prs_uint32(temp, ps, depth, &sen->ptr_sid[i])) { - return False; - } - } - - for (i = 0; i < sen->num_entries; i++) { - fstring temp; - - slprintf(temp, sizeof(temp) - 1, "sid[%d]", i); - if(!smb_io_dom_sid2(temp, &sen->sid[i], ps, depth)) { - return False; - } - } - - return True; -} - -/******************************************************************* - Inits an LSA_R_ENUM_TRUST_DOM structure. -********************************************************************/ - -void init_q_lookup_sids(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_SIDS *q_l, - POLICY_HND *hnd, int num_sids, const DOM_SID *sids, - uint16 level) -{ - DEBUG(5, ("init_q_lookup_sids\n")); - - ZERO_STRUCTP(q_l); - - memcpy(&q_l->pol, hnd, sizeof(q_l->pol)); - init_lsa_sid_enum(mem_ctx, &q_l->sids, num_sids, sids); - - q_l->level = level; -} - -/******************************************************************* - Reads or writes a LSA_Q_LOOKUP_SIDS structure. -********************************************************************/ - -bool lsa_io_q_lookup_sids(const char *desc, LSA_Q_LOOKUP_SIDS *q_s, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol_hnd", &q_s->pol, ps, depth)) /* policy handle */ - return False; - if(!lsa_io_sid_enum("sids ", &q_s->sids, ps, depth)) /* sids to be looked up */ - return False; - if(!lsa_io_trans_names("names ", &q_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_uint16("level", ps, depth, &q_s->level)) /* lookup level */ - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a LSA_Q_LOOKUP_SIDS2 structure. -********************************************************************/ - -bool lsa_io_q_lookup_sids2(const char *desc, LSA_Q_LOOKUP_SIDS2 *q_s, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol_hnd", &q_s->pol, ps, depth)) /* policy handle */ - return False; - if(!lsa_io_sid_enum("sids ", &q_s->sids, ps, depth)) /* sids to be looked up */ - return False; - if(!lsa_io_trans_names2("names ", &q_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_uint16("level", ps, depth, &q_s->level)) /* lookup level */ - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count)) - return False; - if(!prs_uint32("unknown1", ps, depth, &q_s->unknown1)) - return False; - if(!prs_uint32("unknown2", ps, depth, &q_s->unknown2)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a LSA_Q_LOOKUP_SIDS3 structure. -********************************************************************/ - -bool lsa_io_q_lookup_sids3(const char *desc, LSA_Q_LOOKUP_SIDS3 *q_s, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_lookup_sids3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!lsa_io_sid_enum("sids ", &q_s->sids, ps, depth)) /* sids to be looked up */ - return False; - if(!lsa_io_trans_names2("names ", &q_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_uint16("level", ps, depth, &q_s->level)) /* lookup level */ - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &q_s->mapped_count)) - return False; - if(!prs_uint32("unknown1", ps, depth, &q_s->unknown1)) - return False; - if(!prs_uint32("unknown2", ps, depth, &q_s->unknown2)) - return False; - - return True; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool lsa_io_trans_names(const char *desc, LSA_TRANS_NAME_ENUM *trn, - prs_struct *ps, int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "lsa_io_trans_names"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries ", ps, depth, &trn->num_entries)) - return False; - if(!prs_uint32("ptr_trans_names", ps, depth, &trn->ptr_trans_names)) - return False; - - if (trn->ptr_trans_names != 0) { - if(!prs_uint32("num_entries2 ", ps, depth, - &trn->num_entries2)) - return False; - - if (trn->num_entries2 != trn->num_entries) { - /* RPC fault */ - return False; - } - - if (UNMARSHALLING(ps) && trn->num_entries2) { - if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME, trn->num_entries2)) == NULL) { - return False; - } - - if ((trn->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, trn->num_entries2)) == NULL) { - return False; - } - } - - for (i = 0; i < trn->num_entries2; i++) { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); - - if(!lsa_io_trans_name(t, &trn->name[i], ps, depth)) /* translated name */ - return False; - } - - for (i = 0; i < trn->num_entries2; i++) { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); - - if(!smb_io_unistr2(t, &trn->uni_name[i], trn->name[i].hdr_name.buffer, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool lsa_io_trans_names2(const char *desc, LSA_TRANS_NAME_ENUM2 *trn, - prs_struct *ps, int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "lsa_io_trans_names2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries ", ps, depth, &trn->num_entries)) - return False; - if(!prs_uint32("ptr_trans_names", ps, depth, &trn->ptr_trans_names)) - return False; - - if (trn->ptr_trans_names != 0) { - if(!prs_uint32("num_entries2 ", ps, depth, - &trn->num_entries2)) - return False; - - if (trn->num_entries2 != trn->num_entries) { - /* RPC fault */ - return False; - } - - if (UNMARSHALLING(ps) && trn->num_entries2) { - if ((trn->name = PRS_ALLOC_MEM(ps, LSA_TRANS_NAME2, trn->num_entries2)) == NULL) { - return False; - } - - if ((trn->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, trn->num_entries2)) == NULL) { - return False; - } - } - - for (i = 0; i < trn->num_entries2; i++) { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); - - if(!lsa_io_trans_name2(t, &trn->name[i], ps, depth)) /* translated name */ - return False; - } - - for (i = 0; i < trn->num_entries2; i++) { - fstring t; - slprintf(t, sizeof(t) - 1, "name[%d] ", i); - - if(!smb_io_unistr2(t, &trn->uni_name[i], trn->name[i].hdr_name.buffer, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - } - - return True; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool lsa_io_r_lookup_sids(const char *desc, LSA_R_LOOKUP_SIDS *r_s, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_dom_ref", ps, depth, &r_s->ptr_dom_ref)) - return False; - - if (r_s->ptr_dom_ref != 0) - if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth)) /* domain reference info */ - return False; - - if(!lsa_io_trans_names("names ", &r_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count)) - return False; - - if(!prs_ntstatus("status ", ps, depth, &r_s->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool lsa_io_r_lookup_sids2(const char *desc, LSA_R_LOOKUP_SIDS2 *r_s, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_dom_ref", ps, depth, &r_s->ptr_dom_ref)) - return False; - - if (r_s->ptr_dom_ref != 0) - if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth)) /* domain reference info */ - return False; - - if(!lsa_io_trans_names2("names ", &r_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count)) - return False; - - if(!prs_ntstatus("status ", ps, depth, &r_s->status)) - return False; - - return True; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool lsa_io_r_lookup_sids3(const char *desc, LSA_R_LOOKUP_SIDS3 *r_s, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_lookup_sids3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_dom_ref", ps, depth, &r_s->ptr_dom_ref)) - return False; - - if (r_s->ptr_dom_ref != 0) - if(!lsa_io_dom_r_ref ("dom_ref", r_s->dom_ref, ps, depth)) /* domain reference info */ - return False; - - if(!lsa_io_trans_names2("names ", &r_s->names, ps, depth)) /* translated names */ - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("mapped_count", ps, depth, &r_s->mapped_count)) - return False; - - if(!prs_ntstatus("status ", ps, depth, &r_s->status)) - return False; - - return True; -} diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index a216eaa730..f43258d5e5 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -126,43 +126,6 @@ static void init_dom_query_5(struct lsa_DomainInfo *r, r->sid = sid; } -/*************************************************************************** - init_dom_ref - adds a domain if it's not already in, returns the index. -***************************************************************************/ - -static int init_dom_ref(DOM_R_REF *ref, const char *dom_name, DOM_SID *dom_sid) -{ - int num = 0; - - if (dom_name != NULL) { - for (num = 0; num < ref->num_ref_doms_1; num++) { - if (sid_equal(dom_sid, &ref->ref_dom[num].ref_dom.sid)) - return num; - } - } else { - num = ref->num_ref_doms_1; - } - - if (num >= MAX_REF_DOMAINS) { - /* index not found, already at maximum domain limit */ - return -1; - } - - ref->num_ref_doms_1 = num+1; - ref->ptr_ref_dom = 1; - ref->max_entries = MAX_REF_DOMAINS; - ref->num_ref_doms_2 = num+1; - - ref->hdr_ref_dom[num].ptr_dom_sid = 1; /* dom sid cannot be NULL. */ - - init_unistr2(&ref->ref_dom[num].uni_dom_name, dom_name, UNI_FLAGS_NONE); - init_uni_hdr(&ref->hdr_ref_dom[num].hdr_dom_name, &ref->ref_dom[num].uni_dom_name); - - init_dom_sid2(&ref->ref_dom[num].ref_dom, dom_sid ); - - return num; -} - /*************************************************************************** lookup_lsa_rids. Must be called as root for lookup_name to work. ***************************************************************************/ @@ -316,70 +279,6 @@ static NTSTATUS lookup_lsa_sids(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -/*************************************************************************** - Init_reply_lookup_sids. - ***************************************************************************/ - -static void init_reply_lookup_sids2(LSA_R_LOOKUP_SIDS2 *r_l, - DOM_R_REF *ref, - uint32 mapped_count) -{ - r_l->ptr_dom_ref = ref ? 1 : 0; - r_l->dom_ref = ref; - r_l->mapped_count = mapped_count; -} - -/*************************************************************************** - Init_reply_lookup_sids. - ***************************************************************************/ - -static void init_reply_lookup_sids3(LSA_R_LOOKUP_SIDS3 *r_l, - DOM_R_REF *ref, - uint32 mapped_count) -{ - r_l->ptr_dom_ref = ref ? 1 : 0; - r_l->dom_ref = ref; - r_l->mapped_count = mapped_count; -} - -/*************************************************************************** - Init_reply_lookup_sids. - ***************************************************************************/ - -static NTSTATUS init_reply_lookup_sids(TALLOC_CTX *mem_ctx, - LSA_R_LOOKUP_SIDS *r_l, - DOM_R_REF *ref, - LSA_TRANS_NAME_ENUM2 *names, - uint32 mapped_count) -{ - LSA_TRANS_NAME_ENUM *oldnames = &r_l->names; - - oldnames->num_entries = names->num_entries; - oldnames->ptr_trans_names = names->ptr_trans_names; - oldnames->num_entries2 = names->num_entries2; - oldnames->uni_name = names->uni_name; - - if (names->num_entries) { - int i; - - oldnames->name = TALLOC_ARRAY(mem_ctx, LSA_TRANS_NAME, names->num_entries); - - if (!oldnames->name) { - return NT_STATUS_NO_MEMORY; - } - for (i = 0; i < names->num_entries; i++) { - oldnames->name[i].sid_name_use = names->name[i].sid_name_use; - oldnames->name[i].hdr_name = names->name[i].hdr_name; - oldnames->name[i].domain_idx = names->name[i].domain_idx; - } - } - - r_l->ptr_dom_ref = ref ? 1 : 0; - r_l->dom_ref = ref; - r_l->mapped_count = mapped_count; - return NT_STATUS_OK; -} - static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *sd_size) { DOM_SID local_adm_sid; -- cgit