summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-19 01:19:44 +0100
committerGünther Deschner <gd@samba.org>2008-02-19 01:29:14 +0100
commitd48f36819fe825de58f1e4feaab14a811ad53421 (patch)
treea15bd424ddfd3aedc62fcfbe3be5c312a71b67f0 /source3/rpc_parse
parent8db780ac8fc30df1e20e70d83a49365b74a10e0a (diff)
downloadsamba-d48f36819fe825de58f1e4feaab14a811ad53421.tar.gz
samba-d48f36819fe825de58f1e4feaab14a811ad53421.tar.bz2
samba-d48f36819fe825de58f1e4feaab14a811ad53421.zip
Remove unused marshalling for LSA_LOOKUP_SIDS/2/3.
This also removes parse_lsa.c entirely. Guenther (This used to be commit f802ba035c95e63c5a6ff9f2fb484d62341cd1a7)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_lsa.c630
1 files changed, 0 insertions, 630 deletions
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 <jmcd@us.ibm.com> 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 <http://www.gnu.org/licenses/>.
- */
-
-#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;
-}