summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_lsa.c1220
-rw-r--r--source3/rpc_parse/parse_misc.c10
-rw-r--r--source3/rpc_parse/parse_net.c1408
-rw-r--r--source3/rpc_parse/parse_ntsvcs.c279
-rw-r--r--source3/rpc_parse/parse_sec.c24
-rw-r--r--source3/rpc_parse/parse_svcctl.c395
6 files changed, 14 insertions, 3322 deletions
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c
deleted file mode 100644
index 80e90a8265..0000000000
--- a/source3/rpc_parse/parse_lsa.c
+++ /dev/null
@@ -1,1220 +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;
-}
-
-/*******************************************************************
-makes a structure.
-********************************************************************/
-
-void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l,
- POLICY_HND *hnd, int num_names, const char **names,
- int level)
-{
- unsigned int i;
-
- DEBUG(5, ("init_q_lookup_names\n"));
-
- ZERO_STRUCTP(q_l);
-
- q_l->pol = *hnd;
- q_l->num_entries = num_names;
- q_l->num_entries2 = num_names;
- q_l->lookup_level = level;
-
- if (num_names) {
- if ((q_l->uni_name = TALLOC_ZERO_ARRAY(mem_ctx, UNISTR2, num_names)) == NULL) {
- DEBUG(3, ("init_q_lookup_names(): out of memory\n"));
- return;
- }
-
- if ((q_l->hdr_name = TALLOC_ZERO_ARRAY(mem_ctx, UNIHDR, num_names)) == NULL) {
- DEBUG(3, ("init_q_lookup_names(): out of memory\n"));
- return;
- }
- } else {
- q_l->uni_name = NULL;
- q_l->hdr_name = NULL;
- }
-
- for (i = 0; i < num_names; i++) {
- init_unistr2(&q_l->uni_name[i], names[i], UNI_FLAGS_NONE);
- init_uni_hdr(&q_l->hdr_name[i], &q_l->uni_name[i]);
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool lsa_io_q_lookup_names(const char *desc, LSA_Q_LOOKUP_NAMES *q_r,
- prs_struct *ps, int depth)
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "lsa_io_q_lookup_names");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("", &q_r->pol, ps, depth)) /* policy handle */
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_entries ", ps, depth, &q_r->num_entries))
- return False;
- if(!prs_uint32("num_entries2 ", ps, depth, &q_r->num_entries2))
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (q_r->num_entries) {
- if ((q_r->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_r->num_entries)) == NULL)
- return False;
- if ((q_r->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_r->num_entries)) == NULL)
- return False;
- }
- }
-
- for (i = 0; i < q_r->num_entries; i++) {
- if(!prs_align(ps))
- return False;
- if(!smb_io_unihdr("hdr_name", &q_r->hdr_name[i], ps, depth)) /* pointer names */
- return False;
- }
-
- for (i = 0; i < q_r->num_entries; i++) {
- if(!prs_align(ps))
- return False;
- if(!smb_io_unistr2("dom_name", &q_r->uni_name[i], q_r->hdr_name[i].buffer, ps, depth)) /* names to be looked up */
- return False;
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_trans_entries ", ps, depth, &q_r->num_trans_entries))
- return False;
- if(!prs_uint32("ptr_trans_sids ", ps, depth, &q_r->ptr_trans_sids))
- return False;
- if(!prs_uint16("lookup_level ", ps, depth, &q_r->lookup_level))
- return False;
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("mapped_count ", ps, depth, &q_r->mapped_count))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool lsa_io_r_lookup_names(const char *desc, LSA_R_LOOKUP_NAMES *out, prs_struct *ps, int depth)
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "lsa_io_r_lookup_names");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_dom_ref", ps, depth, &out->ptr_dom_ref))
- return False;
-
- if (out->ptr_dom_ref != 0)
- if(!lsa_io_dom_r_ref("", out->dom_ref, ps, depth))
- return False;
-
- if(!prs_uint32("num_entries", ps, depth, &out->num_entries))
- return False;
- if(!prs_uint32("ptr_entries", ps, depth, &out->ptr_entries))
- return False;
-
- if (out->ptr_entries != 0) {
- if(!prs_uint32("num_entries2", ps, depth, &out->num_entries2))
- return False;
-
- if (out->num_entries2 != out->num_entries) {
- /* RPC fault */
- return False;
- }
-
- if (UNMARSHALLING(ps) && out->num_entries2) {
- if ((out->dom_rid = PRS_ALLOC_MEM(ps, DOM_RID, out->num_entries2))
- == NULL) {
- DEBUG(3, ("lsa_io_r_lookup_names(): out of memory\n"));
- return False;
- }
- }
-
- for (i = 0; i < out->num_entries2; i++)
- if(!smb_io_dom_rid("", &out->dom_rid[i], ps, depth)) /* domain RIDs being looked up */
- return False;
- }
-
- if(!prs_uint32("mapped_count", ps, depth, &out->mapped_count))
- return False;
-
- if(!prs_ntstatus("status ", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool lsa_io_q_lookup_names2(const char *desc, LSA_Q_LOOKUP_NAMES2 *q_r,
- prs_struct *ps, int depth)
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "lsa_io_q_lookup_names2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("", &q_r->pol, ps, depth)) /* policy handle */
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_entries ", ps, depth, &q_r->num_entries))
- return False;
- if(!prs_uint32("num_entries2 ", ps, depth, &q_r->num_entries2))
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (q_r->num_entries) {
- if ((q_r->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_r->num_entries)) == NULL)
- return False;
- if ((q_r->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_r->num_entries)) == NULL)
- return False;
- }
- }
-
- for (i = 0; i < q_r->num_entries; i++) {
- if(!prs_align(ps))
- return False;
- if(!smb_io_unihdr("hdr_name", &q_r->hdr_name[i], ps, depth)) /* pointer names */
- return False;
- }
-
- for (i = 0; i < q_r->num_entries; i++) {
- if(!prs_align(ps))
- return False;
- if(!smb_io_unistr2("dom_name", &q_r->uni_name[i], q_r->hdr_name[i].buffer, ps, depth)) /* names to be looked up */
- return False;
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_trans_entries ", ps, depth, &q_r->num_trans_entries))
- return False;
- if(!prs_uint32("ptr_trans_sids ", ps, depth, &q_r->ptr_trans_sids))
- return False;
- if(!prs_uint16("lookup_level ", ps, depth, &q_r->lookup_level))
- return False;
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("mapped_count ", ps, depth, &q_r->mapped_count))
- return False;
- if(!prs_uint32("unknown1 ", ps, depth, &q_r->unknown1))
- return False;
- if(!prs_uint32("unknown2 ", ps, depth, &q_r->unknown2))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool lsa_io_r_lookup_names2(const char *desc, LSA_R_LOOKUP_NAMES2 *out, prs_struct *ps, int depth)
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "lsa_io_r_lookup_names2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_dom_ref", ps, depth, &out->ptr_dom_ref))
- return False;
-
- if (out->ptr_dom_ref != 0)
- if(!lsa_io_dom_r_ref("", out->dom_ref, ps, depth))
- return False;
-
- if(!prs_uint32("num_entries", ps, depth, &out->num_entries))
- return False;
- if(!prs_uint32("ptr_entries", ps, depth, &out->ptr_entries))
- return False;
-
- if (out->ptr_entries != 0) {
- if(!prs_uint32("num_entries2", ps, depth, &out->num_entries2))
- return False;
-
- if (out->num_entries2 != out->num_entries) {
- /* RPC fault */
- return False;
- }
-
- if (UNMARSHALLING(ps) && out->num_entries2) {
- if ((out->dom_rid = PRS_ALLOC_MEM(ps, DOM_RID2, out->num_entries2))
- == NULL) {
- DEBUG(3, ("lsa_io_r_lookup_names2(): out of memory\n"));
- return False;
- }
- }
-
- for (i = 0; i < out->num_entries2; i++)
- if(!smb_io_dom_rid2("", &out->dom_rid[i], ps, depth)) /* domain RIDs being looked up */
- return False;
- }
-
- if(!prs_uint32("mapped_count", ps, depth, &out->mapped_count))
- return False;
-
- if(!prs_ntstatus("status ", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Internal lsa data type io.
- Following pass must read DOM_SID2 types.
-********************************************************************/
-
-bool smb_io_lsa_translated_sids3(const char *desc, LSA_TRANSLATED_SID3 *q_r,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "smb_io_lsa_translated_sids3");
- depth++;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint8 ("sid_type ", ps, depth, &q_r->sid_type ))
- return False;
- if(!prs_align(ps))
- return False;
- /* Second pass will read/write these. */
- if (!smb_io_dom_sid2_p("sid_header", ps, depth, &q_r->sid2))
- return False;
- if(!prs_uint32("sid_idx ", ps, depth, &q_r->sid_idx ))
- return False;
- if(!prs_uint32("unknown ", ps, depth, &q_r->unknown ))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Identical to lsa_io_q_lookup_names2.
-********************************************************************/
-
-bool lsa_io_q_lookup_names3(const char *desc, LSA_Q_LOOKUP_NAMES3 *q_r,
- prs_struct *ps, int depth)
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "lsa_io_q_lookup_names3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("", &q_r->pol, ps, depth)) /* policy handle */
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_entries ", ps, depth, &q_r->num_entries))
- return False;
- if(!prs_uint32("num_entries2 ", ps, depth, &q_r->num_entries2))
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (q_r->num_entries) {
- if ((q_r->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_r->num_entries)) == NULL)
- return False;
- if ((q_r->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_r->num_entries)) == NULL)
- return False;
- }
- }
-
- for (i = 0; i < q_r->num_entries; i++) {
- if(!prs_align(ps))
- return False;
- if(!smb_io_unihdr("hdr_name", &q_r->hdr_name[i], ps, depth)) /* pointer names */
- return False;
- }
-
- for (i = 0; i < q_r->num_entries; i++) {
- if(!prs_align(ps))
- return False;
- if(!smb_io_unistr2("dom_name", &q_r->uni_name[i], q_r->hdr_name[i].buffer, ps, depth)) /* names to be looked up */
- return False;
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_trans_entries ", ps, depth, &q_r->num_trans_entries))
- return False;
- if(!prs_uint32("ptr_trans_sids ", ps, depth, &q_r->ptr_trans_sids))
- return False;
- if(!prs_uint16("lookup_level ", ps, depth, &q_r->lookup_level))
- return False;
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("mapped_count ", ps, depth, &q_r->mapped_count))
- return False;
- if(!prs_uint32("unknown1 ", ps, depth, &q_r->unknown1))
- return False;
- if(!prs_uint32("unknown2 ", ps, depth, &q_r->unknown2))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool lsa_io_r_lookup_names3(const char *desc, LSA_R_LOOKUP_NAMES3 *out, prs_struct *ps, int depth)
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "lsa_io_r_lookup_names3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_dom_ref", ps, depth, &out->ptr_dom_ref))
- return False;
-
- if (out->ptr_dom_ref != 0)
- if(!lsa_io_dom_r_ref("", out->dom_ref, ps, depth))
- return False;
-
- if(!prs_uint32("num_entries", ps, depth, &out->num_entries))
- return False;
- if(!prs_uint32("ptr_entries", ps, depth, &out->ptr_entries))
- return False;
-
- if (out->ptr_entries != 0) {
- if(!prs_uint32("num_entries2", ps, depth, &out->num_entries2))
- return False;
-
- if (out->num_entries2 != out->num_entries) {
- /* RPC fault */
- return False;
- }
-
- if (UNMARSHALLING(ps) && out->num_entries2) {
- if ((out->trans_sids = PRS_ALLOC_MEM(ps, LSA_TRANSLATED_SID3, out->num_entries2))
- == NULL) {
- DEBUG(3, ("lsa_io_r_lookup_names3(): out of memory\n"));
- return False;
- }
- }
-
- for (i = 0; i < out->num_entries2; i++) {
- if(!smb_io_lsa_translated_sids3("", &out->trans_sids[i], ps, depth)) {
- return False;
- }
- }
- /* Now process the DOM_SID2 entries. */
- for (i = 0; i < out->num_entries2; i++) {
- if (out->trans_sids[i].sid2) {
- if( !smb_io_dom_sid2("sid2", out->trans_sids[i].sid2, ps, depth) ) {
- return False;
- }
- }
- }
- }
-
- if(!prs_uint32("mapped_count", ps, depth, &out->mapped_count))
- return False;
-
- if(!prs_ntstatus("status ", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_q_lookup_names4(const char *desc, LSA_Q_LOOKUP_NAMES4 *q_r,
- prs_struct *ps, int depth)
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "lsa_io_q_lookup_names4");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_entries ", ps, depth, &q_r->num_entries))
- return False;
- if(!prs_uint32("num_entries2 ", ps, depth, &q_r->num_entries2))
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (q_r->num_entries) {
- if ((q_r->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_r->num_entries)) == NULL)
- return False;
- if ((q_r->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_r->num_entries)) == NULL)
- return False;
- }
- }
-
- for (i = 0; i < q_r->num_entries; i++) {
- if(!prs_align(ps))
- return False;
- if(!smb_io_unihdr("hdr_name", &q_r->hdr_name[i], ps, depth)) /* pointer names */
- return False;
- }
-
- for (i = 0; i < q_r->num_entries; i++) {
- if(!prs_align(ps))
- return False;
- if(!smb_io_unistr2("dom_name", &q_r->uni_name[i], q_r->hdr_name[i].buffer, ps, depth)) /* names to be looked up */
- return False;
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_trans_entries ", ps, depth, &q_r->num_trans_entries))
- return False;
- if(!prs_uint32("ptr_trans_sids ", ps, depth, &q_r->ptr_trans_sids))
- return False;
- if(!prs_uint16("lookup_level ", ps, depth, &q_r->lookup_level))
- return False;
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("mapped_count ", ps, depth, &q_r->mapped_count))
- return False;
- if(!prs_uint32("unknown1 ", ps, depth, &q_r->unknown1))
- return False;
- if(!prs_uint32("unknown2 ", ps, depth, &q_r->unknown2))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Identical to lsa_io_r_lookup_names3.
-********************************************************************/
-
-bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_struct *ps, int depth)
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "lsa_io_r_lookup_names4");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_dom_ref", ps, depth, &out->ptr_dom_ref))
- return False;
-
- if (out->ptr_dom_ref != 0)
- if(!lsa_io_dom_r_ref("", out->dom_ref, ps, depth))
- return False;
-
- if(!prs_uint32("num_entries", ps, depth, &out->num_entries))
- return False;
- if(!prs_uint32("ptr_entries", ps, depth, &out->ptr_entries))
- return False;
-
- if (out->ptr_entries != 0) {
- if(!prs_uint32("num_entries2", ps, depth, &out->num_entries2))
- return False;
-
- if (out->num_entries2 != out->num_entries) {
- /* RPC fault */
- return False;
- }
-
- if (UNMARSHALLING(ps) && out->num_entries2) {
- if ((out->trans_sids = PRS_ALLOC_MEM(ps, LSA_TRANSLATED_SID3, out->num_entries2))
- == NULL) {
- DEBUG(3, ("lsa_io_r_lookup_names4(): out of memory\n"));
- return False;
- }
- }
-
- for (i = 0; i < out->num_entries2; i++) {
- if(!smb_io_lsa_translated_sids3("", &out->trans_sids[i], ps, depth)) {
- return False;
- }
- }
- /* Now process the DOM_SID2 entries. */
- for (i = 0; i < out->num_entries2; i++) {
- if (out->trans_sids[i].sid2) {
- if( !smb_io_dom_sid2("sid2", out->trans_sids[i].sid2, ps, depth) ) {
- return False;
- }
- }
- }
- }
-
- if(!prs_uint32("mapped_count", ps, depth, &out->mapped_count))
- return False;
-
- if(!prs_ntstatus("status ", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LUID_ATTR structure.
-********************************************************************/
-
-bool policy_handle_is_valid(const POLICY_HND *hnd)
-{
- POLICY_HND zero_pol;
-
- ZERO_STRUCT(zero_pol);
- return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? False : True );
-}
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 9e1937ea32..418f857df8 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -1859,4 +1859,14 @@ uint32 str_len_uni(UNISTR *source)
return i;
}
+/*******************************************************************
+ Verifies policy handle
+********************************************************************/
+bool policy_handle_is_valid(const POLICY_HND *hnd)
+{
+ POLICY_HND zero_pol;
+
+ ZERO_STRUCT(zero_pol);
+ return ((memcmp(&zero_pol, hnd, sizeof(POLICY_HND)) == 0) ? false : true );
+}
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c
deleted file mode 100644
index 8677924d6a..0000000000
--- a/source3/rpc_parse/parse_net.c
+++ /dev/null
@@ -1,1408 +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) Jean Francois Micouleau 2002.
- *
- * 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
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-static bool net_io_neg_flags(const char *desc, NEG_FLAGS *neg, prs_struct *ps, int depth)
-{
- if (neg == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_neg_flags");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("neg_flags", ps, depth, &neg->neg_flags))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an NET_Q_REQ_CHAL structure.
-********************************************************************/
-
-void init_q_req_chal(NET_Q_REQ_CHAL *q_c,
- const char *logon_srv, const char *logon_clnt,
- const DOM_CHAL *clnt_chal)
-{
- DEBUG(5,("init_q_req_chal: %d\n", __LINE__));
-
- q_c->undoc_buffer = 1; /* don't know what this buffer is */
-
- init_unistr2(&q_c->uni_logon_srv, logon_srv , UNI_STR_TERMINATE);
- init_unistr2(&q_c->uni_logon_clnt, logon_clnt, UNI_STR_TERMINATE);
-
- memcpy(q_c->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data));
-
- DEBUG(5,("init_q_req_chal: %d\n", __LINE__));
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_REQ_CHAL structure.
-********************************************************************/
-
-bool net_io_q_req_chal(const char *desc, NET_Q_REQ_CHAL *q_c, prs_struct *ps, int depth)
-{
- if (q_c == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_req_chal");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("undoc_buffer", ps, depth, &q_c->undoc_buffer))
- return False;
-
- if(!smb_io_unistr2("", &q_c->uni_logon_srv, True, ps, depth)) /* logon server unicode string */
- return False;
- if(!smb_io_unistr2("", &q_c->uni_logon_clnt, True, ps, depth)) /* logon client unicode string */
- return False;
-
- if(!smb_io_chal("", &q_c->clnt_chal, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_r_req_chal(const char *desc, NET_R_REQ_CHAL *r_c, prs_struct *ps, int depth)
-{
- if (r_c == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_req_chal");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_chal("", &r_c->srv_chal, ps, depth)) /* server challenge */
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_c->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_q_auth(const char *desc, NET_Q_AUTH *q_a, prs_struct *ps, int depth)
-{
- if (q_a == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_auth");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */
- return False;
- if(!smb_io_chal("", &q_a->clnt_chal, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_r_auth(const char *desc, NET_R_AUTH *r_a, prs_struct *ps, int depth)
-{
- if (r_a == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_auth");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_chal("", &r_a->srv_chal, ps, depth)) /* server challenge */
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_a->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a NET_Q_AUTH_2 struct.
-********************************************************************/
-
-void init_q_auth_2(NET_Q_AUTH_2 *q_a,
- const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name,
- const DOM_CHAL *clnt_chal, uint32 clnt_flgs)
-{
- DEBUG(5,("init_q_auth_2: %d\n", __LINE__));
-
- init_log_info(&q_a->clnt_id, logon_srv, acct_name, sec_chan, comp_name);
- memcpy(q_a->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data));
- q_a->clnt_flgs.neg_flags = clnt_flgs;
-
- DEBUG(5,("init_q_auth_2: %d\n", __LINE__));
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_q_auth_2(const char *desc, NET_Q_AUTH_2 *q_a, prs_struct *ps, int depth)
-{
- if (q_a == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_auth_2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */
- return False;
- if(!smb_io_chal("", &q_a->clnt_chal, ps, depth))
- return False;
- if(!net_io_neg_flags("", &q_a->clnt_flgs, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_r_auth_2(const char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth)
-{
- if (r_a == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_auth_2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_chal("", &r_a->srv_chal, ps, depth)) /* server challenge */
- return False;
- if(!net_io_neg_flags("", &r_a->srv_flgs, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_a->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a NET_Q_AUTH_3 struct.
-********************************************************************/
-
-void init_q_auth_3(NET_Q_AUTH_3 *q_a,
- const char *logon_srv, const char *acct_name, uint16 sec_chan, const char *comp_name,
- const DOM_CHAL *clnt_chal, uint32 clnt_flgs)
-{
- DEBUG(5,("init_q_auth_3: %d\n", __LINE__));
-
- init_log_info(&q_a->clnt_id, logon_srv, acct_name, sec_chan, comp_name);
- memcpy(q_a->clnt_chal.data, clnt_chal->data, sizeof(clnt_chal->data));
- q_a->clnt_flgs.neg_flags = clnt_flgs;
-
- DEBUG(5,("init_q_auth_3: %d\n", __LINE__));
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_q_auth_3(const char *desc, NET_Q_AUTH_3 *q_a, prs_struct *ps, int depth)
-{
- if (q_a == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_auth_3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_log_info ("", &q_a->clnt_id, ps, depth)) /* client identification info */
- return False;
- if(!smb_io_chal("", &q_a->clnt_chal, ps, depth))
- return False;
- if(!net_io_neg_flags("", &q_a->clnt_flgs, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_r_auth_3(const char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int depth)
-{
- if (r_a == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_auth_3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_chal("srv_chal", &r_a->srv_chal, ps, depth)) /* server challenge */
- return False;
- if(!net_io_neg_flags("srv_flgs", &r_a->srv_flgs, ps, depth))
- return False;
- if (!prs_uint32("unknown", ps, depth, &r_a->unknown))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_a->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Inits a NET_Q_SRV_PWSET.
-********************************************************************/
-
-void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s,
- const char *logon_srv, const char *sess_key, const char *acct_name,
- uint16 sec_chan, const char *comp_name,
- DOM_CRED *cred, const uchar hashed_mach_pwd[16])
-{
- unsigned char nt_cypher[16];
-
- DEBUG(5,("init_q_srv_pwset\n"));
-
- /* Process the new password. */
- cred_hash3( nt_cypher, hashed_mach_pwd, (const unsigned char *)sess_key, 1);
-
- init_clnt_info(&q_s->clnt_id, logon_srv, acct_name, sec_chan, comp_name, cred);
-
- memcpy(q_s->pwd, nt_cypher, sizeof(q_s->pwd));
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_q_srv_pwset(const char *desc, NET_Q_SRV_PWSET *q_s, prs_struct *ps, int depth)
-{
- if (q_s == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_srv_pwset");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_clnt_info("", &q_s->clnt_id, ps, depth)) /* client identification/authentication info */
- return False;
- if(!prs_uint8s (False, "pwd", ps, depth, q_s->pwd, 16)) /* new password - undocumented */
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_r_srv_pwset(const char *desc, NET_R_SRV_PWSET *r_s, prs_struct *ps, int depth)
-{
- if (r_s == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_srv_pwset");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_cred("", &r_s->srv_cred, ps, depth)) /* server challenge */
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_s->status))
- return False;
-
- return True;
-}
-
-/*************************************************************************
- Init DOM_SID2 array from a string containing multiple sids
- *************************************************************************/
-
-static int init_dom_sid2s(TALLOC_CTX *ctx, const char *sids_str, DOM_SID2 **ppsids)
-{
- const char *ptr;
- char *s2;
- int count = 0;
-
- DEBUG(4,("init_dom_sid2s: %s\n", sids_str ? sids_str:""));
-
- *ppsids = NULL;
-
- if(sids_str) {
- int number;
- DOM_SID2 *sids;
- TALLOC_CTX *frame = talloc_stackframe();
-
- /* Count the number of valid SIDs. */
- for (count = 0, ptr = sids_str;
- next_token_talloc(frame,&ptr, &s2, NULL); ) {
- DOM_SID tmpsid;
- if (string_to_sid(&tmpsid, s2))
- count++;
- }
-
- /* Now allocate space for them. */
- if (count) {
- *ppsids = TALLOC_ZERO_ARRAY(ctx, DOM_SID2, count);
- if (*ppsids == NULL) {
- TALLOC_FREE(frame);
- return 0;
- }
- } else {
- *ppsids = NULL;
- }
-
- sids = *ppsids;
-
- for (number = 0, ptr = sids_str;
- next_token_talloc(frame, &ptr, &s2, NULL); ) {
- DOM_SID tmpsid;
- if (string_to_sid(&tmpsid, s2)) {
- /* count only valid sids */
- init_dom_sid2(&sids[number], &tmpsid);
- number++;
- }
- }
- TALLOC_FREE(frame);
- }
-
- return count;
-}
-
-/*******************************************************************
- Inits a NET_ID_INFO_1 structure.
-********************************************************************/
-
-void init_id_info1(NET_ID_INFO_1 *id, const char *domain_name,
- uint32 param_ctrl, uint32 log_id_low, uint32 log_id_high,
- const char *user_name, const char *wksta_name,
- const char *sess_key,
- unsigned char lm_cypher[16], unsigned char nt_cypher[16])
-{
- unsigned char lm_owf[16];
- unsigned char nt_owf[16];
-
- DEBUG(5,("init_id_info1: %d\n", __LINE__));
-
- id->ptr_id_info1 = 1;
-
- id->param_ctrl = param_ctrl;
- init_logon_id(&id->logon_id, log_id_low, log_id_high);
-
-
- if (lm_cypher && nt_cypher) {
- unsigned char key[16];
-#ifdef DEBUG_PASSWORD
- DEBUG(100,("lm cypher:"));
- dump_data(100, lm_cypher, 16);
-
- DEBUG(100,("nt cypher:"));
- dump_data(100, nt_cypher, 16);
-#endif
-
- memset(key, 0, 16);
- memcpy(key, sess_key, 8);
-
- memcpy(lm_owf, lm_cypher, 16);
- SamOEMhash(lm_owf, key, 16);
- memcpy(nt_owf, nt_cypher, 16);
- SamOEMhash(nt_owf, key, 16);
-
-#ifdef DEBUG_PASSWORD
- DEBUG(100,("encrypt of lm owf password:"));
- dump_data(100, lm_owf, 16);
-
- DEBUG(100,("encrypt of nt owf password:"));
- dump_data(100, nt_owf, 16);
-#endif
- /* set up pointers to cypher blocks */
- lm_cypher = lm_owf;
- nt_cypher = nt_owf;
- }
-
- init_owf_info(&id->lm_owf, lm_cypher);
- init_owf_info(&id->nt_owf, nt_cypher);
-
- init_unistr2(&id->uni_domain_name, domain_name, UNI_FLAGS_NONE);
- init_uni_hdr(&id->hdr_domain_name, &id->uni_domain_name);
- init_unistr2(&id->uni_user_name, user_name, UNI_FLAGS_NONE);
- init_uni_hdr(&id->hdr_user_name, &id->uni_user_name);
- init_unistr2(&id->uni_wksta_name, wksta_name, UNI_FLAGS_NONE);
- init_uni_hdr(&id->hdr_wksta_name, &id->uni_wksta_name);
-}
-
-/*******************************************************************
- Reads or writes an NET_ID_INFO_1 structure.
-********************************************************************/
-
-static bool net_io_id_info1(const char *desc, NET_ID_INFO_1 *id, prs_struct *ps, int depth)
-{
- if (id == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_id_info1");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_id_info1", ps, depth, &id->ptr_id_info1))
- return False;
-
- if (id->ptr_id_info1 != 0) {
- if(!smb_io_unihdr("unihdr", &id->hdr_domain_name, ps, depth))
- return False;
-
- if(!prs_uint32("param_ctrl", ps, depth, &id->param_ctrl))
- return False;
- if(!smb_io_logon_id("", &id->logon_id, ps, depth))
- return False;
-
- if(!smb_io_unihdr("unihdr", &id->hdr_user_name, ps, depth))
- return False;
- if(!smb_io_unihdr("unihdr", &id->hdr_wksta_name, ps, depth))
- return False;
-
- if(!smb_io_owf_info("", &id->lm_owf, ps, depth))
- return False;
- if(!smb_io_owf_info("", &id->nt_owf, ps, depth))
- return False;
-
- if(!smb_io_unistr2("unistr2", &id->uni_domain_name,
- id->hdr_domain_name.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("unistr2", &id->uni_user_name,
- id->hdr_user_name.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("unistr2", &id->uni_wksta_name,
- id->hdr_wksta_name.buffer, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-Inits a NET_ID_INFO_2 structure.
-
-This is a network logon packet. The log_id parameters
-are what an NT server would generate for LUID once the
-user is logged on. I don't think we care about them.
-
-Note that this has no access to the NT and LM hashed passwords,
-so it forwards the challenge, and the NT and LM responses (24
-bytes each) over the secure channel to the Domain controller
-for it to say yea or nay. This is the preferred method of
-checking for a logon as it doesn't export the password
-hashes to anyone who has compromised the secure channel. JRA.
-********************************************************************/
-
-void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name,
- uint32 param_ctrl,
- uint32 log_id_low, uint32 log_id_high,
- const char *user_name, const char *wksta_name,
- const uchar lm_challenge[8],
- const uchar * lm_chal_resp, size_t lm_chal_resp_len,
- const uchar * nt_chal_resp, size_t nt_chal_resp_len)
-{
-
- DEBUG(5,("init_id_info2: %d\n", __LINE__));
-
- id->ptr_id_info2 = 1;
-
- id->param_ctrl = param_ctrl;
- init_logon_id(&id->logon_id, log_id_low, log_id_high);
-
- memcpy(id->lm_chal, lm_challenge, sizeof(id->lm_chal));
- init_str_hdr(&id->hdr_nt_chal_resp, nt_chal_resp_len, nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0);
- init_str_hdr(&id->hdr_lm_chal_resp, lm_chal_resp_len, lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0);
-
- init_unistr2(&id->uni_domain_name, domain_name, UNI_FLAGS_NONE);
- init_uni_hdr(&id->hdr_domain_name, &id->uni_domain_name);
- init_unistr2(&id->uni_user_name, user_name, UNI_FLAGS_NONE);
- init_uni_hdr(&id->hdr_user_name, &id->uni_user_name);
- init_unistr2(&id->uni_wksta_name, wksta_name, UNI_FLAGS_NONE);
- init_uni_hdr(&id->hdr_wksta_name, &id->uni_wksta_name);
-
- init_string2(&id->nt_chal_resp, (const char *)nt_chal_resp, nt_chal_resp_len, nt_chal_resp_len);
- init_string2(&id->lm_chal_resp, (const char *)lm_chal_resp, lm_chal_resp_len, lm_chal_resp_len);
-
-}
-
-/*******************************************************************
- Reads or writes an NET_ID_INFO_2 structure.
-********************************************************************/
-
-static bool net_io_id_info2(const char *desc, NET_ID_INFO_2 *id, prs_struct *ps, int depth)
-{
- if (id == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_id_info2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_id_info2", ps, depth, &id->ptr_id_info2))
- return False;
-
- if (id->ptr_id_info2 != 0) {
- if(!smb_io_unihdr("unihdr", &id->hdr_domain_name, ps, depth))
- return False;
-
- if(!prs_uint32("param_ctrl", ps, depth, &id->param_ctrl))
- return False;
- if(!smb_io_logon_id("", &id->logon_id, ps, depth))
- return False;
-
- if(!smb_io_unihdr("unihdr", &id->hdr_user_name, ps, depth))
- return False;
- if(!smb_io_unihdr("unihdr", &id->hdr_wksta_name, ps, depth))
- return False;
-
- if(!prs_uint8s (False, "lm_chal", ps, depth, id->lm_chal, 8)) /* lm 8 byte challenge */
- return False;
-
- if(!smb_io_strhdr("hdr_nt_chal_resp", &id->hdr_nt_chal_resp, ps, depth))
- return False;
- if(!smb_io_strhdr("hdr_lm_chal_resp", &id->hdr_lm_chal_resp, ps, depth))
- return False;
-
- if(!smb_io_unistr2("uni_domain_name", &id->uni_domain_name,
- id->hdr_domain_name.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_user_name ", &id->uni_user_name,
- id->hdr_user_name.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_wksta_name ", &id->uni_wksta_name,
- id->hdr_wksta_name.buffer, ps, depth))
- return False;
- if(!smb_io_string2("nt_chal_resp", &id->nt_chal_resp,
- id->hdr_nt_chal_resp.buffer, ps, depth))
- return False;
- if(!smb_io_string2("lm_chal_resp", &id->lm_chal_resp,
- id->hdr_lm_chal_resp.buffer, ps, depth))
- return False;
- }
-
- return True;
-}
-
-
-/*******************************************************************
- Inits a DOM_SAM_INFO structure.
-********************************************************************/
-
-void init_sam_info(DOM_SAM_INFO *sam,
- const char *logon_srv, const char *comp_name,
- DOM_CRED *clnt_cred,
- DOM_CRED *rtn_cred, uint16 logon_level,
- NET_ID_INFO_CTR *ctr)
-{
- DEBUG(5,("init_sam_info: %d\n", __LINE__));
-
- init_clnt_info2(&sam->client, logon_srv, comp_name, clnt_cred);
-
- if (rtn_cred != NULL) {
- sam->ptr_rtn_cred = 1;
- memcpy(&sam->rtn_cred, rtn_cred, sizeof(sam->rtn_cred));
- } else {
- sam->ptr_rtn_cred = 0;
- }
-
- sam->logon_level = logon_level;
- sam->ctr = ctr;
-}
-
-/*******************************************************************
- Inits a DOM_SAM_INFO structure.
-********************************************************************/
-
-void init_sam_info_ex(DOM_SAM_INFO_EX *sam,
- const char *logon_srv, const char *comp_name,
- uint16 logon_level, NET_ID_INFO_CTR *ctr)
-{
- DEBUG(5,("init_sam_info_ex: %d\n", __LINE__));
-
- init_clnt_srv(&sam->client, logon_srv, comp_name);
- sam->logon_level = logon_level;
- sam->ctr = ctr;
-}
-
-/*******************************************************************
- Reads or writes a DOM_SAM_INFO structure.
-********************************************************************/
-
-static bool net_io_id_info_ctr(const char *desc, NET_ID_INFO_CTR **pp_ctr, prs_struct *ps, int depth)
-{
- NET_ID_INFO_CTR *ctr = *pp_ctr;
-
- prs_debug(ps, depth, desc, "smb_io_sam_info_ctr");
- depth++;
-
- if (UNMARSHALLING(ps)) {
- ctr = *pp_ctr = PRS_ALLOC_MEM(ps, NET_ID_INFO_CTR, 1);
- if (ctr == NULL)
- return False;
- }
-
- if (ctr == NULL)
- return False;
-
- /* don't 4-byte align here! */
-
- if(!prs_uint16("switch_value ", ps, depth, &ctr->switch_value))
- return False;
-
- switch (ctr->switch_value) {
- case 1:
- if(!net_io_id_info1("", &ctr->auth.id1, ps, depth))
- return False;
- break;
- case 2:
- if(!net_io_id_info2("", &ctr->auth.id2, ps, depth))
- return False;
- break;
- default:
- /* PANIC! */
- DEBUG(4,("smb_io_sam_info_ctr: unknown switch_value!\n"));
- break;
- }
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a DOM_SAM_INFO structure.
- ********************************************************************/
-
-static bool smb_io_sam_info(const char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_sam_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_clnt_info2("", &sam->client, ps, depth))
- return False;
-
- if(!prs_uint32("ptr_rtn_cred ", ps, depth, &sam->ptr_rtn_cred))
- return False;
- if (sam->ptr_rtn_cred) {
- if(!smb_io_cred("", &sam->rtn_cred, ps, depth))
- return False;
- }
-
- if(!prs_uint16("logon_level ", ps, depth, &sam->logon_level))
- return False;
-
- if (sam->logon_level != 0) {
- if(!net_io_id_info_ctr("logon_info", &sam->ctr, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a DOM_SAM_INFO_EX structure.
- ********************************************************************/
-
-static bool smb_io_sam_info_ex(const char *desc, DOM_SAM_INFO_EX *sam, prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "smb_io_sam_info_ex");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_clnt_srv("", &sam->client, ps, depth))
- return False;
-
- if(!prs_uint16("logon_level ", ps, depth, &sam->logon_level))
- return False;
-
- if (sam->logon_level != 0) {
- if(!net_io_id_info_ctr("logon_info", &sam->ctr, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*************************************************************************
- Inits a NET_USER_INFO_3 structure.
-
- This is a network logon reply packet, and contains much information about
- the user. This information is passed as a (very long) paramater list
- to avoid having to link in the PASSDB code to every program that deals
- with this file.
- *************************************************************************/
-
-void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr,
- uint32 user_rid,
- uint32 group_rid,
-
- const char* user_name,
- const char* full_name,
- const char* home_dir,
- const char* dir_drive,
- const char* logon_script,
- const char* profile_path,
-
- time_t unix_logon_time,
- time_t unix_logoff_time,
- time_t unix_kickoff_time,
- time_t unix_pass_last_set_time,
- time_t unix_pass_can_change_time,
- time_t unix_pass_must_change_time,
-
- uint16 logon_count, uint16 bad_pw_count,
- uint32 num_groups, const DOM_GID *gids,
- uint32 user_flgs, uint32 acct_flags,
- uchar user_session_key[16],
- uchar lm_session_key[16],
- const char *logon_srv, const char *logon_dom,
- const DOM_SID *dom_sid)
-{
- /* only cope with one "other" sid, right now. */
- /* need to count the number of space-delimited sids */
- unsigned int i;
- int num_other_sids = 0;
-
- NTTIME logon_time, logoff_time, kickoff_time,
- pass_last_set_time, pass_can_change_time,
- pass_must_change_time;
-
- ZERO_STRUCTP(usr);
-
- usr->ptr_user_info = 1; /* yes, we're bothering to put USER_INFO data here */
-
- /* Create NTTIME structs */
- unix_to_nt_time (&logon_time, unix_logon_time);
- unix_to_nt_time (&logoff_time, unix_logoff_time);
- unix_to_nt_time (&kickoff_time, unix_kickoff_time);
- unix_to_nt_time (&pass_last_set_time, unix_pass_last_set_time);
- unix_to_nt_time (&pass_can_change_time, unix_pass_can_change_time);
- unix_to_nt_time (&pass_must_change_time, unix_pass_must_change_time);
-
- usr->logon_time = logon_time;
- usr->logoff_time = logoff_time;
- usr->kickoff_time = kickoff_time;
- usr->pass_last_set_time = pass_last_set_time;
- usr->pass_can_change_time = pass_can_change_time;
- usr->pass_must_change_time = pass_must_change_time;
-
- usr->logon_count = logon_count;
- usr->bad_pw_count = bad_pw_count;
-
- usr->user_rid = user_rid;
- usr->group_rid = group_rid;
- usr->num_groups = num_groups;
-
- usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */
- usr->user_flgs = user_flgs;
- usr->acct_flags = acct_flags;
-
- if (user_session_key != NULL)
- memcpy(usr->user_sess_key, user_session_key, sizeof(usr->user_sess_key));
- else
- memset((char *)usr->user_sess_key, '\0', sizeof(usr->user_sess_key));
-
- usr->buffer_dom_id = dom_sid ? 1 : 0; /* yes, we're bothering to put a domain SID in */
-
- memset((char *)usr->lm_sess_key, '\0', sizeof(usr->lm_sess_key));
-
- for (i=0; i<7; i++) {
- memset(&usr->unknown[i], '\0', sizeof(usr->unknown));
- }
-
- if (lm_session_key != NULL) {
- memcpy(usr->lm_sess_key, lm_session_key, sizeof(usr->lm_sess_key));
- }
-
- num_other_sids = init_dom_sid2s(ctx, NULL, &usr->other_sids);
-
- usr->num_other_sids = num_other_sids;
- usr->buffer_other_sids = (num_other_sids != 0) ? 1 : 0;
-
- init_unistr2(&usr->uni_user_name, user_name, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
- init_unistr2(&usr->uni_full_name, full_name, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
- init_unistr2(&usr->uni_logon_script, logon_script, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
- init_unistr2(&usr->uni_profile_path, profile_path, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
- init_unistr2(&usr->uni_home_dir, home_dir, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
- init_unistr2(&usr->uni_dir_drive, dir_drive, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
-
- usr->num_groups2 = num_groups;
-
- if (num_groups) {
- usr->gids = TALLOC_ZERO_ARRAY(ctx,DOM_GID,num_groups);
- if (usr->gids == NULL)
- return;
- } else {
- usr->gids = NULL;
- }
-
- for (i = 0; i < num_groups; i++)
- usr->gids[i] = gids[i];
-
- init_unistr2(&usr->uni_logon_srv, logon_srv, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_logon_srv, &usr->uni_logon_srv);
- init_unistr2(&usr->uni_logon_dom, logon_dom, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_logon_dom, &usr->uni_logon_dom);
-
- init_dom_sid2(&usr->dom_sid, dom_sid);
- /* "other" sids are set up above */
-}
-
-static void dump_acct_flags(uint32 acct_flags) {
-
- int lvl = 10;
- DEBUG(lvl,("dump_acct_flags\n"));
- if (acct_flags & ACB_NORMAL) {
- DEBUGADD(lvl,("\taccount has ACB_NORMAL\n"));
- }
- if (acct_flags & ACB_PWNOEXP) {
- DEBUGADD(lvl,("\taccount has ACB_PWNOEXP\n"));
- }
- if (acct_flags & ACB_ENC_TXT_PWD_ALLOWED) {
- DEBUGADD(lvl,("\taccount has ACB_ENC_TXT_PWD_ALLOWED\n"));
- }
- if (acct_flags & ACB_NOT_DELEGATED) {
- DEBUGADD(lvl,("\taccount has ACB_NOT_DELEGATED\n"));
- }
- if (acct_flags & ACB_USE_DES_KEY_ONLY) {
- DEBUGADD(lvl,("\taccount has ACB_USE_DES_KEY_ONLY set, sig verify wont work\n"));
- }
- if (acct_flags & ACB_NO_AUTH_DATA_REQD) {
- DEBUGADD(lvl,("\taccount has ACB_NO_AUTH_DATA_REQD set\n"));
- }
- if (acct_flags & ACB_PW_EXPIRED) {
- DEBUGADD(lvl,("\taccount has ACB_PW_EXPIRED set\n"));
- }
-}
-
-static void dump_user_flgs(uint32 user_flags) {
-
- int lvl = 10;
- DEBUG(lvl,("dump_user_flgs\n"));
- if (user_flags & NETLOGON_EXTRA_SIDS) {
- DEBUGADD(lvl,("\taccount has NETLOGON_EXTRA_SIDS\n"));
- }
- if (user_flags & NETLOGON_RESOURCE_GROUPS) {
- DEBUGADD(lvl,("\taccount has NETLOGON_RESOURCE_GROUPS\n"));
- }
- if (user_flags & NETLOGON_NTLMV2_ENABLED) {
- DEBUGADD(lvl,("\taccount has NETLOGON_NTLMV2_ENABLED\n"));
- }
- if (user_flags & NETLOGON_CACHED_ACCOUNT) {
- DEBUGADD(lvl,("\taccount has NETLOGON_CACHED_ACCOUNT\n"));
- }
- if (user_flags & NETLOGON_PROFILE_PATH_RETURNED) {
- DEBUGADD(lvl,("\taccount has NETLOGON_PROFILE_PATH_RETURNED\n"));
- }
- if (user_flags & NETLOGON_SERVER_TRUST_ACCOUNT) {
- DEBUGADD(lvl,("\taccount has NETLOGON_SERVER_TRUST_ACCOUNT\n"));
- }
-
-
-}
-
-/*******************************************************************
- This code has been modified to cope with a NET_USER_INFO_2 - which is
- exactly the same as a NET_USER_INFO_3, minus the other sids parameters.
- We use validation level to determine if we're marshalling a info 2 or
- INFO_3 - be we always return an INFO_3. Based on code donated by Marc
- Jacobsen at HP. JRA.
-********************************************************************/
-
-bool net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps,
- int depth, uint16 validation_level, bool kerb_validation_level)
-{
- unsigned int i;
-
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_user_info3");
- depth++;
-
- if (UNMARSHALLING(ps))
- ZERO_STRUCTP(usr);
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_user_info ", ps, depth, &usr->ptr_user_info))
- return False;
-
- if (usr->ptr_user_info == 0)
- return True;
-
- if(!smb_io_time("logon time", &usr->logon_time, ps, depth)) /* logon time */
- return False;
- if(!smb_io_time("logoff time", &usr->logoff_time, ps, depth)) /* logoff time */
- return False;
- if(!smb_io_time("kickoff time", &usr->kickoff_time, ps, depth)) /* kickoff time */
- return False;
- if(!smb_io_time("last set time", &usr->pass_last_set_time, ps, depth)) /* password last set time */
- return False;
- if(!smb_io_time("can change time", &usr->pass_can_change_time , ps, depth)) /* password can change time */
- return False;
- if(!smb_io_time("must change time", &usr->pass_must_change_time, ps, depth)) /* password must change time */
- return False;
-
- if(!smb_io_unihdr("hdr_user_name", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
- return False;
- if(!smb_io_unihdr("hdr_full_name", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
- return False;
- if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
- return False;
- if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
- return False;
- if(!smb_io_unihdr("hdr_home_dir", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
- return False;
- if(!smb_io_unihdr("hdr_dir_drive", &usr->hdr_dir_drive, ps, depth)) /* home directory drive unicode string header */
- return False;
-
- if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count)) /* logon count */
- return False;
- if(!prs_uint16("bad_pw_count ", ps, depth, &usr->bad_pw_count)) /* bad password count */
- return False;
-
- if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User RID */
- return False;
- if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group RID */
- return False;
- if(!prs_uint32("num_groups ", ps, depth, &usr->num_groups)) /* num groups */
- return False;
- if(!prs_uint32("buffer_groups ", ps, depth, &usr->buffer_groups)) /* undocumented buffer pointer to groups. */
- return False;
- if(!prs_uint32("user_flgs ", ps, depth, &usr->user_flgs)) /* user flags */
- return False;
- dump_user_flgs(usr->user_flgs);
- if(!prs_uint8s(False, "user_sess_key", ps, depth, usr->user_sess_key, 16)) /* user session key */
- return False;
-
- if(!smb_io_unihdr("hdr_logon_srv", &usr->hdr_logon_srv, ps, depth)) /* logon server unicode string header */
- return False;
- if(!smb_io_unihdr("hdr_logon_dom", &usr->hdr_logon_dom, ps, depth)) /* logon domain unicode string header */
- return False;
-
- if(!prs_uint32("buffer_dom_id ", ps, depth, &usr->buffer_dom_id)) /* undocumented logon domain id pointer */
- return False;
-
- if(!prs_uint8s(False, "lm_sess_key", ps, depth, usr->lm_sess_key, 8)) /* lm session key */
- return False;
-
- if(!prs_uint32("acct_flags ", ps, depth, &usr->acct_flags)) /* Account flags */
- return False;
- dump_acct_flags(usr->acct_flags);
- for (i = 0; i < 7; i++)
- {
- if (!prs_uint32("unkown", ps, depth, &usr->unknown[i])) /* unknown */
- return False;
- }
-
- if (validation_level == 3) {
- if(!prs_uint32("num_other_sids", ps, depth, &usr->num_other_sids)) /* 0 - num_sids */
- return False;
- if(!prs_uint32("buffer_other_sids", ps, depth, &usr->buffer_other_sids)) /* NULL - undocumented pointer to SIDs. */
- return False;
- } else {
- if (UNMARSHALLING(ps)) {
- usr->num_other_sids = 0;
- usr->buffer_other_sids = 0;
- }
- }
-
- /* get kerb validation info (not really part of user_info_3) - Guenther */
-
- if (kerb_validation_level) {
-
- if(!prs_uint32("ptr_res_group_dom_sid", ps, depth, &usr->ptr_res_group_dom_sid))
- return False;
- if(!prs_uint32("res_group_count", ps, depth, &usr->res_group_count))
- return False;
- if(!prs_uint32("ptr_res_groups", ps, depth, &usr->ptr_res_groups))
- return False;
- }
-
- if(!smb_io_unistr2("uni_user_name", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
- return False;
- if(!smb_io_unistr2("uni_full_name", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
- return False;
- if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
- return False;
- if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
- return False;
- if(!smb_io_unistr2("uni_home_dir", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
- return False;
- if(!smb_io_unistr2("uni_dir_drive", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_groups2 ", ps, depth, &usr->num_groups2)) /* num groups2 */
- return False;
-
- if (usr->num_groups != usr->num_groups2) {
- DEBUG(3,("net_io_user_info3: num_groups mismatch! (%d != %d)\n",
- usr->num_groups, usr->num_groups2));
- return False;
- }
-
- if (UNMARSHALLING(ps)) {
- if (usr->num_groups) {
- usr->gids = PRS_ALLOC_MEM(ps, DOM_GID, usr->num_groups);
- if (usr->gids == NULL)
- return False;
- } else {
- usr->gids = NULL;
- }
- }
-
- for (i = 0; i < usr->num_groups; i++) {
- if(!smb_io_gid("", &usr->gids[i], ps, depth)) /* group info */
- return False;
- }
-
- if(!smb_io_unistr2("uni_logon_srv", &usr->uni_logon_srv, usr->hdr_logon_srv.buffer, ps, depth)) /* logon server unicode string */
- return False;
- if(!smb_io_unistr2("uni_logon_dom", &usr->uni_logon_dom, usr->hdr_logon_dom.buffer, ps, depth)) /* logon domain unicode string */
- return False;
-
- if(!smb_io_dom_sid2("", &usr->dom_sid, ps, depth)) /* domain SID */
- return False;
-
- if (validation_level == 3 && usr->buffer_other_sids) {
-
- uint32 num_other_sids = usr->num_other_sids;
-
- if (!(usr->user_flgs & NETLOGON_EXTRA_SIDS)) {
- DEBUG(10,("net_io_user_info3: user_flgs attribute does not have NETLOGON_EXTRA_SIDS\n"));
- /* return False; */
- }
-
- if (!prs_uint32("num_other_sids", ps, depth,
- &num_other_sids))
- return False;
-
- if (num_other_sids != usr->num_other_sids)
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (usr->num_other_sids) {
- usr->other_sids = PRS_ALLOC_MEM(ps, DOM_SID2, usr->num_other_sids);
- usr->other_sids_attrib =
- PRS_ALLOC_MEM(ps, uint32, usr->num_other_sids);
- } else {
- usr->other_sids = NULL;
- usr->other_sids_attrib = NULL;
- }
-
- if ((num_other_sids != 0) &&
- ((usr->other_sids == NULL) ||
- (usr->other_sids_attrib == NULL)))
- return False;
- }
-
- /* First the pointers to the SIDS and attributes */
-
- depth++;
-
- for (i=0; i<usr->num_other_sids; i++) {
- uint32 ptr = 1;
-
- if (!prs_uint32("sid_ptr", ps, depth, &ptr))
- return False;
-
- if (UNMARSHALLING(ps) && (ptr == 0))
- return False;
-
- if (!prs_uint32("attribute", ps, depth,
- &usr->other_sids_attrib[i]))
- return False;
- }
-
- for (i = 0; i < usr->num_other_sids; i++) {
- if(!smb_io_dom_sid2("", &usr->other_sids[i], ps, depth)) /* other domain SIDs */
- return False;
- }
-
- depth--;
- }
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_q_sam_logon(const char *desc, NET_Q_SAM_LOGON *q_l, prs_struct *ps, int depth)
-{
- if (q_l == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_sam_logon");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_sam_info("", &q_l->sam_id, ps, depth))
- return False;
-
- if(!prs_align_uint16(ps))
- return False;
-
- if(!prs_uint16("validation_level", ps, depth, &q_l->validation_level))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_r_sam_logon(const char *desc, NET_R_SAM_LOGON *r_l, prs_struct *ps, int depth)
-{
- if (r_l == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_sam_logon");
- depth++;
-
- if(!prs_uint32("buffer_creds", ps, depth, &r_l->buffer_creds)) /* undocumented buffer pointer */
- return False;
- if (&r_l->buffer_creds) {
- if(!smb_io_cred("", &r_l->srv_creds, ps, depth)) /* server credentials. server time stamp appears to be ignored. */
- return False;
- }
-
- if(!prs_uint16("switch_value", ps, depth, &r_l->switch_value))
- return False;
- if(!prs_align(ps))
- return False;
-
-#if 1 /* W2k always needs this - even for bad passwd. JRA */
- if(!net_io_user_info3("", r_l->user, ps, depth, r_l->switch_value, False))
- return False;
-#else
- if (r_l->switch_value != 0) {
- if(!net_io_user_info3("", r_l->user, ps, depth, r_l->switch_value, False))
- return False;
- }
-#endif
-
- if(!prs_uint32("auth_resp ", ps, depth, &r_l->auth_resp)) /* 1 - Authoritative response; 0 - Non-Auth? */
- return False;
-
- if(!prs_ntstatus("status ", ps, depth, &r_l->status))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_q_sam_logon_ex(const char *desc, NET_Q_SAM_LOGON_EX *q_l, prs_struct *ps, int depth)
-{
- if (q_l == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_sam_logon_ex");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_sam_info_ex("", &q_l->sam_id, ps, depth))
- return False;
-
- if(!prs_align_uint16(ps))
- return False;
-
- if(!prs_uint16("validation_level", ps, depth, &q_l->validation_level))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if(!prs_uint32("flags ", ps, depth, &q_l->flags))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_r_sam_logon_ex(const char *desc, NET_R_SAM_LOGON_EX *r_l, prs_struct *ps, int depth)
-{
- if (r_l == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_sam_logon_ex");
- depth++;
-
- if(!prs_uint16("switch_value", ps, depth, &r_l->switch_value))
- return False;
- if(!prs_align(ps))
- return False;
-
-#if 1 /* W2k always needs this - even for bad passwd. JRA */
- if(!net_io_user_info3("", r_l->user, ps, depth, r_l->switch_value, False))
- return False;
-#else
- if (r_l->switch_value != 0) {
- if(!net_io_user_info3("", r_l->user, ps, depth, r_l->switch_value, False))
- return False;
- }
-#endif
-
- if(!prs_uint32("auth_resp ", ps, depth, &r_l->auth_resp)) /* 1 - Authoritative response; 0 - Non-Auth? */
- return False;
-
- if(!prs_uint32("flags ", ps, depth, &r_l->flags))
- return False;
-
- if(!prs_ntstatus("status ", ps, depth, &r_l->status))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_q_sam_logoff(const char *desc, NET_Q_SAM_LOGOFF *q_l, prs_struct *ps, int depth)
-{
- if (q_l == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_sam_logoff");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_sam_info("", &q_l->sam_id, ps, depth)) /* domain SID */
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a structure.
-********************************************************************/
-
-bool net_io_r_sam_logoff(const char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int depth)
-{
- if (r_l == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_sam_logoff");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("buffer_creds", ps, depth, &r_l->buffer_creds)) /* undocumented buffer pointer */
- return False;
- if(!smb_io_cred("", &r_l->srv_creds, ps, depth)) /* server credentials. server time stamp appears to be ignored. */
- return False;
-
- if(!prs_ntstatus("status ", ps, depth, &r_l->status))
- return False;
-
- return True;
-}
diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c
index 5758517ca0..2b15a45506 100644
--- a/source3/rpc_parse/parse_ntsvcs.c
+++ b/source3/rpc_parse/parse_ntsvcs.c
@@ -25,96 +25,6 @@
/*******************************************************************
********************************************************************/
-bool ntsvcs_io_q_get_version(const char *desc, NTSVCS_Q_GET_VERSION *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "ntsvcs_io_q_get_version");
- depth++;
-
- /* there is nothing to parse in this PDU */
-
- return True;
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool ntsvcs_io_r_get_version(const char *desc, NTSVCS_R_GET_VERSION *r_u, prs_struct *ps, int depth)
-{
- if ( !r_u )
- return False;
-
- prs_debug(ps, depth, desc, "ntsvcs_io_r_get_version");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("version", ps, depth, &r_u->version))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool ntsvcs_io_q_get_device_list_size(const char *desc, NTSVCS_Q_GET_DEVICE_LIST_SIZE *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_list_size");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_pointer("devicename", ps, depth, (void*)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
- if ( !prs_uint32("flags", ps, depth, &q_u->flags) )
- return False;
-
- return True;
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool ntsvcs_io_r_get_device_list_size(const char *desc, NTSVCS_R_GET_DEVICE_LIST_SIZE *r_u, prs_struct *ps, int depth)
-{
- if ( !r_u )
- return False;
-
- prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_list_size");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("size", ps, depth, &r_u->size))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-********************************************************************/
-
bool ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL)
@@ -171,49 +81,6 @@ bool ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u
/*******************************************************************
********************************************************************/
-bool ntsvcs_io_q_validate_device_instance(const char *desc, NTSVCS_Q_VALIDATE_DEVICE_INSTANCE *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "ntsvcs_io_q_validate_device_instance");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) )
- return False;
- if( !prs_align(ps) )
- return False;
-
- if ( !prs_uint32("flags", ps, depth, &q_u->flags) )
- return False;
-
- return True;
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool ntsvcs_io_r_validate_device_instance(const char *desc, NTSVCS_R_VALIDATE_DEVICE_INSTANCE *r_u, prs_struct *ps, int depth)
-{
- if ( !r_u )
- return False;
-
- prs_debug(ps, depth, desc, "ntsvcs_io_r_validate_device_instance");
- depth++;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
bool ntsvcs_io_q_get_device_reg_property(const char *desc, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL)
@@ -278,149 +145,3 @@ bool ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_R
return True;
}
-
-/*******************************************************************
-********************************************************************/
-
-bool ntsvcs_io_q_get_hw_profile_info(const char *desc, NTSVCS_Q_GET_HW_PROFILE_INFO *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "ntsvcs_io_q_get_hw_profile_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_uint32("index", ps, depth, &q_u->index) )
- return False;
-
- q_u->buffer_size = 0x000000a8;
-
- if ( UNMARSHALLING(ps) ) {
- q_u->buffer = TALLOC_ARRAY(talloc_tos(), uint8, q_u->buffer_size );
- if (!q_u->buffer) {
- return False;
- }
- }
-
- if ( !prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size) )
- return False;
-
- if ( !prs_uint32("buffer_size", ps, depth, &q_u->buffer_size) )
- return False;
-
- if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) )
- return False;
-
- return True;
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool ntsvcs_io_r_get_hw_profile_info(const char *desc, NTSVCS_R_GET_HW_PROFILE_INFO *r_u, prs_struct *ps, int depth)
-{
- if ( !r_u )
- return False;
-
- prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_reg_property");
- depth++;
-
- if ( !prs_align(ps) )
- return False;
-
- if ( UNMARSHALLING(ps) ) {
- if (r_u->buffer_size) {
- r_u->buffer = TALLOC_ARRAY(talloc_tos(), uint8, r_u->buffer_size );
- if (!r_u->buffer) {
- return False;
- }
- } else {
- r_u->buffer = NULL;
- }
- }
-
- if ( !prs_uint8s(True, "buffer", ps, depth, r_u->buffer, r_u->buffer_size) )
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool ntsvcs_io_q_hw_profile_flags(const char *desc, NTSVCS_Q_HW_PROFILE_FLAGS *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "ntsvcs_io_q_hw_profile_flags");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) )
- return False;
-
-
- if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) )
- return False;
- if( !prs_align(ps) )
- return False;
-
- if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) )
- return False;
- if ( !prs_uint32("unknown3", ps, depth, &q_u->unknown3) )
- return False;
- if ( !prs_uint32("unknown4", ps, depth, &q_u->unknown4) )
- return False;
- if ( !prs_uint32("unknown5", ps, depth, &q_u->unknown5) )
- return False;
- if ( !prs_uint32("unknown6", ps, depth, &q_u->unknown6) )
- return False;
- if ( !prs_uint32("unknown7", ps, depth, &q_u->unknown7) )
- return False;
-
- if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) )
- return False;
-
- return True;
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool ntsvcs_io_r_hw_profile_flags(const char *desc, NTSVCS_R_HW_PROFILE_FLAGS *r_u, prs_struct *ps, int depth)
-{
- if ( !r_u )
- return False;
-
- prs_debug(ps, depth, desc, "ntsvcs_io_r_hw_profile_flags");
- depth++;
-
- if ( !prs_align(ps) )
- return False;
-
- if ( !prs_uint32("unknown1", ps, depth, &r_u->unknown1) )
- return False;
- if ( !prs_uint32("unknown2", ps, depth, &r_u->unknown2) )
- return False;
- if ( !prs_uint32("unknown3", ps, depth, &r_u->unknown3) )
- return False;
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-
-
-
diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c
index 6ea128d3a4..c71b31086a 100644
--- a/source3/rpc_parse/parse_sec.c
+++ b/source3/rpc_parse/parse_sec.c
@@ -27,28 +27,11 @@
#define DBGC_CLASS DBGC_RPC_PARSE
/*******************************************************************
- Reads or writes a SEC_ACCESS structure.
-********************************************************************/
-
-bool sec_io_access(const char *desc, SEC_ACCESS *t, prs_struct *ps, int depth)
-{
- if (t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sec_io_access");
- depth++;
-
- if(!prs_uint32("mask", ps, depth, t))
- return False;
-
- return True;
-}
-
-/*******************************************************************
Reads or writes a SEC_ACE structure.
********************************************************************/
-bool sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth)
+static bool sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps,
+ int depth)
{
uint32 old_offset;
uint32 offset_ace_size;
@@ -130,7 +113,8 @@ bool sec_io_ace(const char *desc, SEC_ACE *psa, prs_struct *ps, int depth)
for you as it reads them.
********************************************************************/
-bool sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
+static bool sec_io_acl(const char *desc, SEC_ACL **ppsa, prs_struct *ps,
+ int depth)
{
unsigned int i;
uint32 old_offset;
diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c
index 18e12ef0a6..ececf1b5ed 100644
--- a/source3/rpc_parse/parse_svcctl.c
+++ b/source3/rpc_parse/parse_svcctl.c
@@ -198,225 +198,6 @@ uint32 svcctl_sizeof_service_config( SERVICE_CONFIG *config )
/*******************************************************************
********************************************************************/
-bool svcctl_io_q_open_scmanager(const char *desc, SVCCTL_Q_OPEN_SCMANAGER *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_open_scmanager");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
- return False;
- if(!prs_align(ps))
- return False;
-
- if(!prs_pointer("database", ps, depth, (void*)&q_u->database, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2))
- return False;
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("access", ps, depth, &q_u->access))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_open_scmanager(const char *desc, SVCCTL_R_OPEN_SCMANAGER *r_u, prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_open_scmanager");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("scm_pol", &r_u->handle, ps, depth))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_q_get_display_name(const char *desc, SVCCTL_Q_GET_DISPLAY_NAME *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_get_display_name");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
- return False;
-
- if(!smb_io_unistr2("servicename", &q_u->servicename, 1, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("display_name_len", ps, depth, &q_u->display_name_len))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool init_svcctl_r_get_display_name( SVCCTL_R_GET_DISPLAY_NAME *r_u, const char *displayname )
-{
- r_u->display_name_len = strlen(displayname);
- init_unistr2( &r_u->displayname, displayname, UNI_STR_TERMINATE );
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_get_display_name(const char *desc, SVCCTL_R_GET_DISPLAY_NAME *r_u, prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_get_display_name");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
-
- if(!smb_io_unistr2("displayname", &r_u->displayname, 1, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("display_name_len", ps, depth, &r_u->display_name_len))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_q_open_service(const char *desc, SVCCTL_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_open_service");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
- return False;
-
- if(!smb_io_unistr2("servicename", &q_u->servicename, 1, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("access", ps, depth, &q_u->access))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_open_service(const char *desc, SVCCTL_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_open_service");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("service_pol", &r_u->handle, ps, depth))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_q_query_status(const char *desc, SVCCTL_Q_QUERY_STATUS *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_query_status");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_query_status(const char *desc, SVCCTL_R_QUERY_STATUS *r_u, prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_query_status");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!svcctl_io_service_status("service_status", &r_u->svc_status, ps, depth))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
bool svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL)
@@ -481,50 +262,6 @@ bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_S
/*******************************************************************
********************************************************************/
-bool svcctl_io_q_start_service(const char *desc, SVCCTL_Q_START_SERVICE *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_start_service");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
- return False;
-
- if(!prs_uint32("parmcount", ps, depth, &q_u->parmcount))
- return False;
-
- if ( !prs_pointer("rights", ps, depth, (void*)&q_u->parameters, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) )
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_start_service(const char *desc, SVCCTL_R_START_SERVICE *r_u, prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_start_service");
- depth++;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-********************************************************************/
-
bool svcctl_io_q_enum_dependent_services(const char *desc, SVCCTL_Q_ENUM_DEPENDENT_SERVICES *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL)
@@ -581,53 +318,6 @@ bool svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDE
/*******************************************************************
********************************************************************/
-bool svcctl_io_q_control_service(const char *desc, SVCCTL_Q_CONTROL_SERVICE *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_control_service");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
- return False;
-
- if(!prs_uint32("control", ps, depth, &q_u->control))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_control_service(const char *desc, SVCCTL_R_CONTROL_SERVICE *r_u, prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_control_service");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!svcctl_io_service_status("service_status", &r_u->svc_status, ps, depth))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-********************************************************************/
-
bool svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL)
@@ -903,91 +593,6 @@ bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVIC
/*******************************************************************
********************************************************************/
-bool svcctl_io_q_lock_service_db(const char *desc, SVCCTL_Q_LOCK_SERVICE_DB *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_lock_service_db");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("scm_handle", &q_u->handle, ps, depth))
- return False;
-
- return True;
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_lock_service_db(const char *desc, SVCCTL_R_LOCK_SERVICE_DB *r_u, prs_struct *ps, int depth)
-{
- if ( !r_u )
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_lock_service_db");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("lock_handle", &r_u->h_lock, ps, depth))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_q_unlock_service_db(const char *desc, SVCCTL_Q_UNLOCK_SERVICE_DB *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_unlock_service_db");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("h_lock", &q_u->h_lock, ps, depth))
- return False;
-
- return True;
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_unlock_service_db(const char *desc, SVCCTL_R_UNLOCK_SERVICE_DB *r_u, prs_struct *ps, int depth)
-{
- if ( !r_u )
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_unlock_service_db");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
bool svcctl_io_q_query_service_sec(const char *desc, SVCCTL_Q_QUERY_SERVICE_SEC *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL)