summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_ds.c299
-rw-r--r--source3/rpc_parse/parse_eventlog.c200
-rw-r--r--source3/rpc_parse/parse_lsa.c3705
-rw-r--r--source3/rpc_parse/parse_misc.c10
-rw-r--r--source3/rpc_parse/parse_net.c3930
-rw-r--r--source3/rpc_parse/parse_ntsvcs.c279
-rw-r--r--source3/rpc_parse/parse_samr.c8057
-rw-r--r--source3/rpc_parse/parse_sec.c24
-rw-r--r--source3/rpc_parse/parse_svcctl.c502
9 files changed, 14 insertions, 16992 deletions
diff --git a/source3/rpc_parse/parse_ds.c b/source3/rpc_parse/parse_ds.c
deleted file mode 100644
index 8f3ce361e7..0000000000
--- a/source3/rpc_parse/parse_ds.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * RPC Pipe client / server routines
-
- * Copyright (C) Gerald Carter 2002-2003
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 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"
-
-/************************************************************************
-************************************************************************/
-
-static bool ds_io_dominfobasic(const char *desc, DSROLE_PRIMARY_DOMAIN_INFO_BASIC **basic, prs_struct *ps, int depth)
-{
- DSROLE_PRIMARY_DOMAIN_INFO_BASIC *p = *basic;
-
- if ( UNMARSHALLING(ps) ) {
- p = *basic = PRS_ALLOC_MEM(ps, DSROLE_PRIMARY_DOMAIN_INFO_BASIC, 1);
- }
-
- if ( !p )
- return False;
-
- if ( !prs_uint16("machine_role", ps, depth, &p->machine_role) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
- if ( !prs_uint32("flags", ps, depth, &p->flags) )
- return False;
-
- if ( !prs_uint32("netbios_ptr", ps, depth, &p->netbios_ptr) )
- return False;
- if ( !prs_uint32("dnsname_ptr", ps, depth, &p->dnsname_ptr) )
- return False;
- if ( !prs_uint32("forestname_ptr", ps, depth, &p->forestname_ptr) )
- return False;
-
- if ( !smb_io_uuid("domain_guid", &p->domain_guid, ps, depth) )
- return False;
-
- if ( !smb_io_unistr2( "netbios_domain", &p->netbios_domain, p->netbios_ptr, ps, depth) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
- if ( !smb_io_unistr2( "dns_domain", &p->dns_domain, p->dnsname_ptr, ps, depth) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
- if ( !smb_io_unistr2( "forest_domain", &p->forest_domain, p->forestname_ptr, ps, depth) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
-
- return True;
-
-}
-
-/************************************************************************
-************************************************************************/
-
-bool ds_io_q_getprimdominfo( const char *desc, DS_Q_GETPRIMDOMINFO *q_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "ds_io_q_getprimdominfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_uint16( "level", ps, depth, &q_u->level ) )
- return False;
-
- return True;
-}
-
-/************************************************************************
-************************************************************************/
-
-bool ds_io_r_getprimdominfo( const char *desc, DS_R_GETPRIMDOMINFO *r_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "ds_io_r_getprimdominfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_uint32( "ptr", ps, depth, &r_u->ptr ) )
- return False;
-
- if ( r_u->ptr )
- {
- if ( !prs_uint16( "level", ps, depth, &r_u->level ) )
- return False;
-
- if ( !prs_uint16( "unknown0", ps, depth, &r_u->unknown0 ) )
- return False;
-
- switch ( r_u->level )
- {
- case DsRolePrimaryDomainInfoBasic:
- if ( !ds_io_dominfobasic( "dominfobasic", &r_u->info.basic, ps, depth) )
- return False;
- break;
- default:
- return False;
- }
- }
-
- if ( !prs_align(ps) )
- return False;
-
- if ( !prs_ntstatus("status", ps, depth, &r_u->status ) )
- return False;
-
- return True;
-}
-
-/************************************************************************
- initialize a DS_ENUM_DOM_TRUSTS structure
-************************************************************************/
-
-bool init_q_ds_enum_domain_trusts( DS_Q_ENUM_DOM_TRUSTS *q, const char *server, uint32 flags )
-{
- q->flags = flags;
-
- if ( server && *server )
- q->server_ptr = 1;
- else
- q->server_ptr = 0;
-
- init_unistr2( &q->server, server, UNI_STR_TERMINATE);
-
- return True;
-}
-
-/************************************************************************
-************************************************************************/
-
-static bool ds_io_domain_trusts( const char *desc, DS_DOMAIN_TRUSTS *trust, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "ds_io_dom_trusts_ctr");
- depth++;
-
- if ( !prs_uint32( "netbios_ptr", ps, depth, &trust->netbios_ptr ) )
- return False;
-
- if ( !prs_uint32( "dns_ptr", ps, depth, &trust->dns_ptr ) )
- return False;
-
- if ( !prs_uint32( "flags", ps, depth, &trust->flags ) )
- return False;
-
- if ( !prs_uint32( "parent_index", ps, depth, &trust->parent_index ) )
- return False;
-
- if ( !prs_uint32( "trust_type", ps, depth, &trust->trust_type ) )
- return False;
-
- if ( !prs_uint32( "trust_attributes", ps, depth, &trust->trust_attributes ) )
- return False;
-
- if ( !prs_uint32( "sid_ptr", ps, depth, &trust->sid_ptr ) )
- return False;
-
- if ( !smb_io_uuid("guid", &trust->guid, ps, depth) )
- return False;
-
- return True;
-}
-
-/************************************************************************
-************************************************************************/
-
-static bool ds_io_dom_trusts_ctr( const char *desc, DS_DOMAIN_TRUSTS_CTR *ctr, prs_struct *ps, int depth)
-{
- int i;
-
- prs_debug(ps, depth, desc, "ds_io_dom_trusts_ctr");
- depth++;
-
- if ( !prs_uint32( "ptr", ps, depth, &ctr->ptr ) )
- return False;
-
- if ( !prs_uint32( "max_count", ps, depth, &ctr->max_count ) )
- return False;
-
- /* are we done? */
-
- if ( ctr->max_count == 0 )
- return True;
-
- /* allocate the domain trusts array are parse it */
-
- ctr->trusts = TALLOC_ARRAY(ps->mem_ctx, DS_DOMAIN_TRUSTS, ctr->max_count);
-
- if ( !ctr->trusts )
- return False;
-
- /* this stinks; the static portion o fthe structure is read here and then
- we need another loop to read the UNISTR2's and SID's */
-
- for ( i=0; i<ctr->max_count;i++ ) {
- if ( !ds_io_domain_trusts("domain_trusts", &ctr->trusts[i], ps, depth) )
- return False;
- }
-
- for ( i=0; i<ctr->max_count; i++ ) {
-
- if ( !smb_io_unistr2("netbios_domain", &ctr->trusts[i].netbios_domain, ctr->trusts[i].netbios_ptr, ps, depth) )
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if ( !smb_io_unistr2("dns_domain", &ctr->trusts[i].dns_domain, ctr->trusts[i].dns_ptr, ps, depth) )
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if ( ctr->trusts[i].sid_ptr ) {
- if ( !smb_io_dom_sid2("sid", &ctr->trusts[i].sid, ps, depth ) )
- return False;
- }
- }
-
- return True;
-}
-
-/************************************************************************
- initialize a DS_ENUM_DOM_TRUSTS request
-************************************************************************/
-
-bool ds_io_q_enum_domain_trusts( const char *desc, DS_Q_ENUM_DOM_TRUSTS *q_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "ds_io_q_enum_domain_trusts");
- depth++;
-
- if ( !prs_align(ps) )
- return False;
-
- if ( !prs_uint32( "server_ptr", ps, depth, &q_u->server_ptr ) )
- return False;
-
- if ( !smb_io_unistr2("server", &q_u->server, q_u->server_ptr, ps, depth) )
- return False;
-
- if ( !prs_align(ps) )
- return False;
-
- if ( !prs_uint32( "flags", ps, depth, &q_u->flags ) )
- return False;
-
- return True;
-}
-
-/************************************************************************
-************************************************************************/
-
-bool ds_io_r_enum_domain_trusts( const char *desc, DS_R_ENUM_DOM_TRUSTS *r_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "ds_io_r_enum_domain_trusts");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_uint32( "num_domains", ps, depth, &r_u->num_domains ) )
- return False;
-
- if ( r_u->num_domains ) {
- if ( !ds_io_dom_trusts_ctr("domains", &r_u->domains, ps, depth) )
- return False;
- }
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_ntstatus("status", ps, depth, &r_u->status ) )
- return False;
-
- return True;
-}
diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c
index 70226bca15..2ff217eb9e 100644
--- a/source3/rpc_parse/parse_eventlog.c
+++ b/source3/rpc_parse/parse_eventlog.c
@@ -25,154 +25,6 @@
/********************************************************************
********************************************************************/
-bool prs_ev_open_unknown0( const char *desc, prs_struct *ps, int depth, EVENTLOG_OPEN_UNKNOWN0 *u )
-{
- if ( !u )
- return False;
-
- if ( !prs_uint16("", ps, depth, &u->unknown1) )
- return False;
- if ( !prs_uint16("", ps, depth, &u->unknown2) )
- return False;
-
- return True;
-}
-
-/********************************************************************
-********************************************************************/
-
-bool eventlog_io_q_open_eventlog(const char *desc, EVENTLOG_Q_OPEN_EVENTLOG *q_u,
- prs_struct *ps, int depth)
-{
- if(q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "eventlog_io_q_open_eventlog");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_pointer("", ps, depth, (void*)&q_u->unknown0, sizeof(EVENTLOG_OPEN_UNKNOWN0), (PRS_POINTER_CAST)prs_ev_open_unknown0))
- return False;
-
- if ( !prs_unistr4("logname", ps, depth, &q_u->logname) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
- if ( !prs_unistr4("servername", ps, depth, &q_u->servername) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
- if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) )
- return False;
- if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) )
- return False;
-
- return True;
-}
-
-bool eventlog_io_r_open_eventlog(const char *desc, EVENTLOG_R_OPEN_EVENTLOG *r_u,
- prs_struct *ps, int depth)
-{
- if(r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "eventlog_io_r_open_eventlog");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!(smb_io_pol_hnd("log handle", &(r_u->handle), ps, depth)))
- return False;
-
- if(!(prs_ntstatus("status code", ps, depth, &r_u->status)))
- return False;
-
- return True;
-}
-
-bool eventlog_io_q_get_num_records(const char *desc, EVENTLOG_Q_GET_NUM_RECORDS *q_u,
- prs_struct *ps, int depth)
-{
- if(q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "eventlog_io_q_get_num_records");
- depth++;
-
- if(!(prs_align(ps)))
- return False;
-
- if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth)))
- return False;
-
- return True;
-}
-
-bool eventlog_io_r_get_num_records(const char *desc, EVENTLOG_R_GET_NUM_RECORDS *r_u,
- prs_struct *ps, int depth)
-{
- if(r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "eventlog_io_r_get_num_records");
- depth++;
-
- if(!(prs_align(ps)))
- return False;
-
- if(!(prs_uint32("num records", ps, depth, &(r_u->num_records))))
- return False;
-
- if(!(prs_ntstatus("status code", ps, depth, &r_u->status)))
- return False;
-
- return True;
-}
-
-bool eventlog_io_q_get_oldest_entry(const char *desc, EVENTLOG_Q_GET_OLDEST_ENTRY *q_u,
- prs_struct *ps, int depth)
-{
- if(q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "eventlog_io_q_get_oldest_entry");
- depth++;
-
- if(!(prs_align(ps)))
- return False;
-
- if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth)))
- return False;
-
- return True;
-}
-
-bool eventlog_io_r_get_oldest_entry(const char *desc, EVENTLOG_R_GET_OLDEST_ENTRY *r_u,
- prs_struct *ps, int depth)
-{
- if(r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "eventlog_io_r_get_oldest_entry");
- depth++;
-
- if(!(prs_align(ps)))
- return False;
-
- if(!(prs_uint32("oldest entry", ps, depth, &(r_u->oldest_entry))))
- return False;
-
- if(!(prs_ntstatus("status code", ps, depth, &r_u->status)))
- return False;
-
- return True;
-}
-
bool eventlog_io_q_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u,
prs_struct *ps, int depth)
{
@@ -339,55 +191,3 @@ bool eventlog_io_r_read_eventlog(const char *desc,
return True;
}
-
-/** The windows client seems to be doing something funny with the file name
- A call like
- ClearEventLog(handle, "backup_file")
- on the client side will result in the backup file name looking like this on the
- server side:
- \??\${CWD of client}\backup_file
- If an absolute path gets specified, such as
- ClearEventLog(handle, "C:\\temp\\backup_file")
- then it is still mangled by the client into this:
- \??\C:\temp\backup_file
- when it is on the wire.
- I'm not sure where the \?? is coming from, or why the ${CWD} of the client process
- would be added in given that the backup file gets written on the server side. */
-
-bool eventlog_io_q_clear_eventlog(const char *desc, EVENTLOG_Q_CLEAR_EVENTLOG *q_u,
- prs_struct *ps, int depth)
-{
- if(q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "eventlog_io_q_clear_eventlog");
- depth++;
-
- if(!prs_align(ps))
- return False;
- if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth)))
- return False;
-
- if ( !prs_unistr4("backupfile", ps, depth, &q_u->backupfile) )
- return False;
-
- return True;
-
-}
-
-bool eventlog_io_r_clear_eventlog(const char *desc, EVENTLOG_R_CLEAR_EVENTLOG *r_u,
- prs_struct *ps, int depth)
-{
- if(r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "eventlog_io_r_clear_eventlog");
- depth++;
-
- if(!prs_align(ps))
- return False;
- if(!(prs_ntstatus("status code", ps, depth, &r_u->status)))
- return False;
-
- return True;
-}
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c
deleted file mode 100644
index 98c4283347..0000000000
--- a/source3/rpc_parse/parse_lsa.c
+++ /dev/null
@@ -1,3705 +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 an LSA_SEC_QOS structure.
-********************************************************************/
-
-void init_lsa_sec_qos(LSA_SEC_QOS *qos, uint16 imp_lev, uint8 ctxt, uint8 eff)
-{
- DEBUG(5, ("init_lsa_sec_qos\n"));
-
- qos->len = 0x0c; /* length of quality of service block, in bytes */
- qos->sec_imp_level = imp_lev;
- qos->sec_ctxt_mode = ctxt;
- qos->effective_only = eff;
-}
-
-/*******************************************************************
- Reads or writes an LSA_SEC_QOS structure.
-********************************************************************/
-
-static bool lsa_io_sec_qos(const char *desc, LSA_SEC_QOS *qos, prs_struct *ps,
- int depth)
-{
- uint32 start;
-
- prs_debug(ps, depth, desc, "lsa_io_obj_qos");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- start = prs_offset(ps);
-
- /* these pointers had _better_ be zero, because we don't know
- what they point to!
- */
- if(!prs_uint32("len ", ps, depth, &qos->len)) /* 0x18 - length (in bytes) inc. the length field. */
- return False;
- if(!prs_uint16("sec_imp_level ", ps, depth, &qos->sec_imp_level ))
- return False;
- if(!prs_uint8 ("sec_ctxt_mode ", ps, depth, &qos->sec_ctxt_mode ))
- return False;
- if(!prs_uint8 ("effective_only", ps, depth, &qos->effective_only))
- return False;
-
- if (qos->len != prs_offset(ps) - start) {
- DEBUG(3,("lsa_io_sec_qos: length %x does not match size %x\n",
- qos->len, prs_offset(ps) - start));
- }
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_OBJ_ATTR structure.
-********************************************************************/
-
-static void init_lsa_obj_attr(LSA_OBJ_ATTR *attr, uint32 attributes, LSA_SEC_QOS *qos)
-{
- DEBUG(5, ("init_lsa_obj_attr\n"));
-
- attr->len = 0x18; /* length of object attribute block, in bytes */
- attr->ptr_root_dir = 0;
- attr->ptr_obj_name = 0;
- attr->attributes = attributes;
- attr->ptr_sec_desc = 0;
-
- if (qos != NULL) {
- attr->ptr_sec_qos = 1;
- attr->sec_qos = qos;
- } else {
- attr->ptr_sec_qos = 0;
- attr->sec_qos = NULL;
- }
-}
-
-/*******************************************************************
- Reads or writes an LSA_OBJ_ATTR structure.
-********************************************************************/
-
-static bool lsa_io_obj_attr(const char *desc, LSA_OBJ_ATTR *attr, prs_struct *ps,
- int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_obj_attr");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- /* these pointers had _better_ be zero, because we don't know
- what they point to!
- */
- if(!prs_uint32("len ", ps, depth, &attr->len)) /* 0x18 - length (in bytes) inc. the length field. */
- return False;
- if(!prs_uint32("ptr_root_dir", ps, depth, &attr->ptr_root_dir)) /* 0 - root directory (pointer) */
- return False;
- if(!prs_uint32("ptr_obj_name", ps, depth, &attr->ptr_obj_name)) /* 0 - object name (pointer) */
- return False;
- if(!prs_uint32("attributes ", ps, depth, &attr->attributes)) /* 0 - attributes (undocumented) */
- return False;
- if(!prs_uint32("ptr_sec_desc", ps, depth, &attr->ptr_sec_desc)) /* 0 - security descriptior (pointer) */
- return False;
- if(!prs_uint32("ptr_sec_qos ", ps, depth, &attr->ptr_sec_qos )) /* security quality of service (pointer) */
- return False;
-
- if (attr->ptr_sec_qos != 0) {
- if (UNMARSHALLING(ps))
- if (!(attr->sec_qos = PRS_ALLOC_MEM(ps,LSA_SEC_QOS,1)))
- return False;
-
- if(!lsa_io_sec_qos("sec_qos", attr->sec_qos, ps, depth))
- return False;
- }
-
- return True;
-}
-
-
-/*******************************************************************
- Inits an LSA_Q_OPEN_POL structure.
-********************************************************************/
-
-void init_q_open_pol(LSA_Q_OPEN_POL *in, uint16 system_name,
- uint32 attributes, uint32 desired_access,
- LSA_SEC_QOS *qos)
-{
- DEBUG(5, ("init_open_pol: attr:%d da:%d\n", attributes,
- desired_access));
-
- in->ptr = 1; /* undocumented pointer */
-
- in->des_access = desired_access;
-
- in->system_name = system_name;
- init_lsa_obj_attr(&in->attr, attributes, qos);
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_OPEN_POL structure.
-********************************************************************/
-
-bool lsa_io_q_open_pol(const char *desc, LSA_Q_OPEN_POL *in, prs_struct *ps,
- int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_open_pol");
- depth++;
-
- if(!prs_uint32("ptr ", ps, depth, &in->ptr))
- return False;
- if(!prs_uint16("system_name", ps, depth, &in->system_name))
- return False;
- if(!prs_align( ps ))
- return False;
-
- if(!lsa_io_obj_attr("", &in->attr, ps, depth))
- return False;
-
- if(!prs_uint32("des_access", ps, depth, &in->des_access))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_OPEN_POL structure.
-********************************************************************/
-
-bool lsa_io_r_open_pol(const char *desc, LSA_R_OPEN_POL *out, prs_struct *ps,
- int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_open_pol");
- depth++;
-
- if(!smb_io_pol_hnd("", &out->pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_Q_OPEN_POL2 structure.
-********************************************************************/
-
-void init_q_open_pol2(LSA_Q_OPEN_POL2 *in, const char *server_name,
- uint32 attributes, uint32 desired_access,
- LSA_SEC_QOS *qos)
-{
- DEBUG(5, ("init_q_open_pol2: attr:%d da:%d\n", attributes,
- desired_access));
-
- in->ptr = 1; /* undocumented pointer */
-
- in->des_access = desired_access;
-
- init_unistr2(&in->uni_server_name, server_name, UNI_STR_TERMINATE);
-
- init_lsa_obj_attr(&in->attr, attributes, qos);
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_OPEN_POL2 structure.
-********************************************************************/
-
-bool lsa_io_q_open_pol2(const char *desc, LSA_Q_OPEN_POL2 *in, prs_struct *ps,
- int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_open_pol2");
- depth++;
-
- if(!prs_uint32("ptr ", ps, depth, &in->ptr))
- return False;
-
- if(!smb_io_unistr2 ("", &in->uni_server_name, in->ptr, ps, depth))
- return False;
- if(!lsa_io_obj_attr("", &in->attr, ps, depth))
- return False;
-
- if(!prs_uint32("des_access", ps, depth, &in->des_access))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_OPEN_POL2 structure.
-********************************************************************/
-
-bool lsa_io_r_open_pol2(const char *desc, LSA_R_OPEN_POL2 *out, prs_struct *ps,
- int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_open_pol2");
- depth++;
-
- if(!smb_io_pol_hnd("", &out->pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-makes an LSA_Q_QUERY_SEC_OBJ structure.
-********************************************************************/
-
-void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *in, const POLICY_HND *hnd,
- uint32 sec_info)
-{
- DEBUG(5, ("init_q_query_sec_obj\n"));
-
- in->pol = *hnd;
- in->sec_info = sec_info;
-
- return;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_QUERY_SEC_OBJ structure.
-********************************************************************/
-
-bool lsa_io_q_query_sec_obj(const char *desc, LSA_Q_QUERY_SEC_OBJ *in,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_query_sec_obj");
- depth++;
-
- if (!smb_io_pol_hnd("", &in->pol, ps, depth))
- return False;
-
- if (!prs_uint32("sec_info", ps, depth, &in->sec_info))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a LSA_R_QUERY_SEC_OBJ structure.
-********************************************************************/
-
-bool lsa_io_r_query_sec_obj(const char *desc, LSA_R_QUERY_SEC_OBJ *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_query_sec_obj");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr", ps, depth, &out->ptr))
- return False;
-
- if (out->ptr != 0) {
- if (!sec_io_desc_buf("sec", &out->buf, ps, depth))
- return False;
- }
-
- if (!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_Q_QUERY_INFO structure.
-********************************************************************/
-
-void init_q_query(LSA_Q_QUERY_INFO *in, POLICY_HND *hnd, uint16 info_class)
-{
- DEBUG(5, ("init_q_query\n"));
-
- memcpy(&in->pol, hnd, sizeof(in->pol));
-
- in->info_class = info_class;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_QUERY_INFO structure.
-********************************************************************/
-
-bool lsa_io_q_query(const char *desc, LSA_Q_QUERY_INFO *in, prs_struct *ps,
- int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_query");
- depth++;
-
- if(!smb_io_pol_hnd("", &in->pol, ps, depth))
- return False;
-
- if(!prs_uint16("info_class", ps, depth, &in->info_class))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-makes an LSA_Q_ENUM_TRUST_DOM structure.
-********************************************************************/
-bool init_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM * q_e, POLICY_HND *pol,
- uint32 enum_context, uint32 preferred_len)
-{
- DEBUG(5, ("init_q_enum_trust_dom\n"));
-
- q_e->pol = *pol;
- q_e->enum_context = enum_context;
- q_e->preferred_len = preferred_len;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_ENUM_TRUST_DOM structure.
-********************************************************************/
-
-bool lsa_io_q_enum_trust_dom(const char *desc, LSA_Q_ENUM_TRUST_DOM *q_e,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom");
- depth++;
-
- if(!smb_io_pol_hnd("", &q_e->pol, ps, depth))
- return False;
-
- if(!prs_uint32("enum_context ", ps, depth, &q_e->enum_context))
- return False;
- if(!prs_uint32("preferred_len", ps, depth, &q_e->preferred_len))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_R_ENUM_TRUST_DOM structure.
-********************************************************************/
-
-void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out,
- uint32 enum_context, uint32 num_domains,
- struct trustdom_info **td)
-{
- unsigned int i;
-
- DEBUG(5, ("init_r_enum_trust_dom\n"));
-
- out->enum_context = enum_context;
- out->count = num_domains;
-
- if ( num_domains != 0 ) {
-
- /* allocate container memory */
-
- out->domlist = TALLOC_P( ctx, DOMAIN_LIST );
-
- if ( !out->domlist ) {
- out->status = NT_STATUS_NO_MEMORY;
- return;
- }
-
- if (out->count) {
- out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO,
- out->count );
- if ( !out->domlist->domains ) {
- out->status = NT_STATUS_NO_MEMORY;
- return;
- }
- } else {
- out->domlist->domains = NULL;
- }
-
- out->domlist->count = out->count;
-
- /* initialize the list of domains and their sid */
-
- for (i = 0; i < num_domains; i++) {
- smb_ucs2_t *name;
- if ( !(out->domlist->domains[i].sid =
- TALLOC_P(ctx, DOM_SID2)) ) {
- out->status = NT_STATUS_NO_MEMORY;
- return;
- }
-
- init_dom_sid2(out->domlist->domains[i].sid,
- &(td[i])->sid);
- if (push_ucs2_talloc(ctx, &name, (td[i])->name) == (size_t)-1){
- out->status = NT_STATUS_NO_MEMORY;
- return;
- }
- init_unistr4_w(ctx, &out->domlist->domains[i].name,
- name);
- }
- }
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_domain_list( const char *desc, prs_struct *ps, int depth, DOMAIN_LIST *domlist )
-{
- int i;
-
- prs_debug(ps, depth, desc, "lsa_io_domain_list");
- depth++;
-
- if(!prs_uint32("count", ps, depth, &domlist->count))
- return False;
-
- if ( domlist->count == 0 )
- return True;
-
- if ( UNMARSHALLING(ps) ) {
- if ( !(domlist->domains = PRS_ALLOC_MEM( ps, DOMAIN_INFO, domlist->count )) )
- return False;
- }
-
- /* headers */
-
- for ( i=0; i<domlist->count; i++ ) {
- if ( !prs_unistr4_hdr("name_header", ps, depth, &domlist->domains[i].name) )
- return False;
- if ( !smb_io_dom_sid2_p("sid_header", ps, depth, &domlist->domains[i].sid) )
- return False;
- }
-
- /* data */
-
- for ( i=0; i<domlist->count; i++ ) {
- if ( !prs_unistr4_str("name", ps, depth, &domlist->domains[i].name) )
- return False;
- if( !smb_io_dom_sid2("sid", domlist->domains[i].sid, ps, depth) )
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_ENUM_TRUST_DOM structure.
-********************************************************************/
-
-bool lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *out,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom");
- depth++;
-
- if(!prs_uint32("enum_context", ps, depth, &out->enum_context))
- return False;
-
- if(!prs_uint32("count", ps, depth, &out->count))
- return False;
-
- if ( !prs_pointer("trusted_domains", ps, depth, (void*)&out->domlist, sizeof(DOMAIN_LIST), (PRS_POINTER_CAST)lsa_io_domain_list))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool lsa_io_dom_query_1(const char *desc, DOM_QUERY_1 *d_q, prs_struct *ps, int depth)
-{
- if (d_q == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_dom_query_1");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("percent_full", ps, depth, &d_q->percent_full))
- return False;
- if (!prs_uint32("log_size", ps, depth, &d_q->log_size))
- return False;
- if (!smb_io_nttime("retention_time", ps, depth, &d_q->retention_time))
- return False;
- if (!prs_uint8("shutdown_in_progress", ps, depth, &d_q->shutdown_in_progress))
- return False;
- if (!smb_io_nttime("time_to_shutdown", ps, depth, &d_q->time_to_shutdown))
- return False;
- if (!prs_uint32("next_audit_record", ps, depth, &d_q->next_audit_record))
- return False;
- if (!prs_uint32("unknown", ps, depth, &d_q->unknown))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool lsa_io_dom_query_2(const char *desc, DOM_QUERY_2 *d_q, prs_struct *ps, int depth)
-{
- if (d_q == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_dom_query_2");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("auditing_enabled", ps, depth, &d_q->auditing_enabled))
- return False;
- if (!prs_uint32("ptr ", ps, depth, &d_q->ptr))
- return False;
- if (!prs_uint32("count1", ps, depth, &d_q->count1))
- return False;
-
- if (d_q->ptr) {
-
- if (!prs_uint32("count2", ps, depth, &d_q->count2))
- return False;
-
- if (d_q->count1 != d_q->count2)
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (d_q->count2) {
- d_q->auditsettings = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint32, d_q->count2);
- if (!d_q->auditsettings) {
- return False;
- }
- } else {
- d_q->auditsettings = NULL;
- }
- }
-
- if (!prs_uint32s(False, "auditsettings", ps, depth, d_q->auditsettings, d_q->count2))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a dom query structure.
-********************************************************************/
-
-static bool lsa_io_dom_query_3(const char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth)
-{
- if (d_q == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_dom_query_3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint16("uni_dom_max_len", ps, depth, &d_q->uni_dom_max_len)) /* domain name string length * 2 */
- return False;
- if(!prs_uint16("uni_dom_str_len", ps, depth, &d_q->uni_dom_str_len)) /* domain name string length * 2 */
- return False;
-
- if(!prs_uint32("buffer_dom_name", ps, depth, &d_q->buffer_dom_name)) /* undocumented domain name string buffer pointer */
- return False;
- if(!prs_uint32("buffer_dom_sid ", ps, depth, &d_q->buffer_dom_sid)) /* undocumented domain SID string buffer pointer */
- return False;
-
- if(!smb_io_unistr2("unistr2", &d_q->uni_domain_name, d_q->buffer_dom_name, ps, depth)) /* domain name (unicode string) */
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if (d_q->buffer_dom_sid != 0) {
- if(!smb_io_dom_sid2("", &d_q->dom_sid, ps, depth)) /* domain SID */
- return False;
- } else {
- memset((char *)&d_q->dom_sid, '\0', sizeof(d_q->dom_sid));
- }
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a dom query structure.
-********************************************************************/
-
-static bool lsa_io_dom_query_5(const char *desc, DOM_QUERY_5 *d_q, prs_struct *ps, int depth)
-{
- return lsa_io_dom_query_3("", d_q, ps, depth);
-}
-
-/*******************************************************************
- Reads or writes a dom query structure.
-********************************************************************/
-
-static bool lsa_io_dom_query_6(const char *desc, DOM_QUERY_6 *d_q, prs_struct *ps, int depth)
-{
- if (d_q == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_dom_query_6");
- depth++;
-
- if (!prs_uint16("server_role", ps, depth, &d_q->server_role))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a dom query structure.
-********************************************************************/
-
-static bool lsa_io_dom_query_10(const char *desc, DOM_QUERY_10 *d_q, prs_struct *ps, int depth)
-{
- if (d_q == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_dom_query_10");
- depth++;
-
- if (!prs_uint8("shutdown_on_full", ps, depth, &d_q->shutdown_on_full))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes a dom query structure.
-********************************************************************/
-
-static bool lsa_io_dom_query_11(const char *desc, DOM_QUERY_11 *d_q, prs_struct *ps, int depth)
-{
- if (d_q == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_dom_query_11");
- depth++;
-
- if (!prs_uint16("unknown", ps, depth, &d_q->unknown))
- return False;
- if (!prs_uint8("shutdown_on_full", ps, depth, &d_q->shutdown_on_full))
- return False;
- if (!prs_uint8("log_is_full", ps, depth, &d_q->log_is_full))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_DNS_DOM_INFO structure.
-********************************************************************/
-
-bool lsa_io_dom_query_12(const char *desc, DOM_QUERY_12 *info, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_dom_query_12");
- depth++;
-
- if(!prs_align(ps))
- return False;
- if(!smb_io_unihdr("nb_name", &info->hdr_nb_dom_name, ps, depth))
- return False;
- if(!smb_io_unihdr("dns_name", &info->hdr_dns_dom_name, ps, depth))
- return False;
- if(!smb_io_unihdr("forest", &info->hdr_forest_name, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
- if ( !smb_io_uuid("dom_guid", &info->dom_guid, ps, depth) )
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("dom_sid", ps, depth, &info->ptr_dom_sid))
- return False;
-
- if(!smb_io_unistr2("nb_name", &info->uni_nb_dom_name,
- info->hdr_nb_dom_name.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("dns_name", &info->uni_dns_dom_name,
- info->hdr_dns_dom_name.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("forest", &info->uni_forest_name,
- info->hdr_forest_name.buffer, ps, depth))
- return False;
-
- if(!smb_io_dom_sid2("dom_sid", &info->dom_sid, ps, depth))
- return False;
-
- return True;
-
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool lsa_io_query_info_ctr2(const char *desc, prs_struct *ps, int depth, LSA_INFO_CTR2 *ctr)
-{
- prs_debug(ps, depth, desc, "lsa_io_query_info_ctr2");
- depth++;
-
- if(!prs_uint16("info_class", ps, depth, &ctr->info_class))
- return False;
-
- switch (ctr->info_class) {
- case 1:
- if(!lsa_io_dom_query_1("", &ctr->info.id1, ps, depth))
- return False;
- break;
- case 2:
- if(!lsa_io_dom_query_2("", &ctr->info.id2, ps, depth))
- return False;
- break;
- case 3:
- if(!lsa_io_dom_query_3("", &ctr->info.id3, ps, depth))
- return False;
- break;
- case 5:
- if(!lsa_io_dom_query_5("", &ctr->info.id5, ps, depth))
- return False;
- break;
- case 6:
- if(!lsa_io_dom_query_6("", &ctr->info.id6, ps, depth))
- return False;
- break;
- case 10:
- if(!lsa_io_dom_query_10("", &ctr->info.id10, ps, depth))
- return False;
- break;
- case 11:
- if(!lsa_io_dom_query_11("", &ctr->info.id11, ps, depth))
- return False;
- break;
- case 12:
- if(!lsa_io_dom_query_12("", &ctr->info.id12, ps, depth))
- return False;
- break;
- default:
- DEBUG(0,("invalid info_class: %d\n", ctr->info_class));
- return False;
- break;
- }
-
- return True;
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool lsa_io_query_info_ctr(const char *desc, prs_struct *ps, int depth, LSA_INFO_CTR *ctr)
-{
- prs_debug(ps, depth, desc, "lsa_io_query_info_ctr");
- depth++;
-
- if(!prs_uint16("info_class", ps, depth, &ctr->info_class))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- switch (ctr->info_class) {
- case 1:
- if(!lsa_io_dom_query_1("", &ctr->info.id1, ps, depth))
- return False;
- break;
- case 2:
- if(!lsa_io_dom_query_2("", &ctr->info.id2, ps, depth))
- return False;
- break;
- case 3:
- if(!lsa_io_dom_query_3("", &ctr->info.id3, ps, depth))
- return False;
- break;
- case 5:
- if(!lsa_io_dom_query_5("", &ctr->info.id5, ps, depth))
- return False;
- break;
- case 6:
- if(!lsa_io_dom_query_6("", &ctr->info.id6, ps, depth))
- return False;
- break;
- case 10:
- if(!lsa_io_dom_query_10("", &ctr->info.id10, ps, depth))
- return False;
- break;
- case 11:
- if(!lsa_io_dom_query_11("", &ctr->info.id11, ps, depth))
- return False;
- break;
- default:
- DEBUG(0,("invalid info_class: %d\n", ctr->info_class));
- return False;
- break;
- }
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_QUERY_INFO structure.
-********************************************************************/
-
-bool lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *out, prs_struct *ps, int depth)
-{
-
- prs_debug(ps, depth, desc, "lsa_io_r_query");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("dom_ptr", ps, depth, &out->dom_ptr))
- return False;
-
- if (out->dom_ptr) {
-
- if(!lsa_io_query_info_ctr("", ps, depth, &out->ctr))
- return False;
- }
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- 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 LSA_Q_OPEN_SECRET structure.
-********************************************************************/
-
-bool lsa_io_q_open_secret(const char *desc, LSA_Q_OPEN_SECRET *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_open_secret");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("", &in->handle, ps, depth))
- return False;
-
- if(!prs_unistr4 ("secretname", ps, depth, &in->secretname))
- return False;
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("access", ps, depth, &in->access))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_OPEN_SECRET structure.
-********************************************************************/
-
-bool lsa_io_r_open_secret(const char *desc, LSA_R_OPEN_SECRET *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_open_secret");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("", &out->handle, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_Q_ENUM_PRIVS structure.
-********************************************************************/
-
-void init_q_enum_privs(LSA_Q_ENUM_PRIVS *in, POLICY_HND *hnd, uint32 enum_context, uint32 pref_max_length)
-{
- DEBUG(5, ("init_q_enum_privs\n"));
-
- memcpy(&in->pol, hnd, sizeof(in->pol));
-
- in->enum_context = enum_context;
- in->pref_max_length = pref_max_length;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool lsa_io_q_enum_privs(const char *desc, LSA_Q_ENUM_PRIVS *in, prs_struct *ps, int depth)
-{
- if (in == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_q_enum_privs");
- depth++;
-
- if (!smb_io_pol_hnd("", &in->pol, ps, depth))
- return False;
-
- if(!prs_uint32("enum_context ", ps, depth, &in->enum_context))
- return False;
- if(!prs_uint32("pref_max_length", ps, depth, &in->pref_max_length))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool lsa_io_priv_entries(const char *desc, LSA_PRIV_ENTRY *entries, uint32 count, prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (entries == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_priv_entries");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- for (i = 0; i < count; i++) {
- if (!smb_io_unihdr("", &entries[i].hdr_name, ps, depth))
- return False;
- if(!prs_uint32("luid_low ", ps, depth, &entries[i].luid_low))
- return False;
- if(!prs_uint32("luid_high", ps, depth, &entries[i].luid_high))
- return False;
- }
-
- for (i = 0; i < count; i++)
- if (!smb_io_unistr2("", &entries[i].name, entries[i].hdr_name.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_R_ENUM_PRIVS structure.
-********************************************************************/
-
-void init_lsa_r_enum_privs(LSA_R_ENUM_PRIVS *out, uint32 enum_context,
- uint32 count, LSA_PRIV_ENTRY *entries)
-{
- DEBUG(5, ("init_lsa_r_enum_privs\n"));
-
- out->enum_context=enum_context;
- out->count=count;
-
- if (entries!=NULL) {
- out->ptr=1;
- out->count1=count;
- out->privs=entries;
- } else {
- out->ptr=0;
- out->count1=0;
- out->privs=NULL;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *out, prs_struct *ps, int depth)
-{
- if (out == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_r_enum_privs");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("enum_context", ps, depth, &out->enum_context))
- return False;
- if(!prs_uint32("count", ps, depth, &out->count))
- return False;
- if(!prs_uint32("ptr", ps, depth, &out->ptr))
- return False;
-
- if (out->ptr) {
- if(!prs_uint32("count1", ps, depth, &out->count1))
- return False;
-
- if (UNMARSHALLING(ps) && out->count1)
- if (!(out->privs = PRS_ALLOC_MEM(ps, LSA_PRIV_ENTRY, out->count1)))
- return False;
-
- if (!lsa_io_priv_entries("", out->privs, out->count1, ps, depth))
- return False;
- }
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, const char *name, uint16 lang_id, uint16 lang_id_sys)
-{
- memcpy(&trn->pol, hnd, sizeof(trn->pol));
-
- init_unistr2(&trn->name, name, UNI_FLAGS_NONE);
- init_uni_hdr(&trn->hdr_name, &trn->name);
- trn->lang_id = lang_id;
- trn->lang_id_sys = lang_id_sys;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool lsa_io_q_priv_get_dispname(const char *desc, LSA_Q_PRIV_GET_DISPNAME *in, prs_struct *ps, int depth)
-{
- if (in == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_q_priv_get_dispname");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!smb_io_pol_hnd("", &in->pol, ps, depth))
- return False;
-
- if (!smb_io_unihdr("hdr_name", &in->hdr_name, ps, depth))
- return False;
-
- if (!smb_io_unistr2("name", &in->name, in->hdr_name.buffer, ps, depth))
- return False;
-
- if(!prs_uint16("lang_id ", ps, depth, &in->lang_id))
- return False;
- if(!prs_uint16("lang_id_sys", ps, depth, &in->lang_id_sys))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool lsa_io_r_priv_get_dispname(const char *desc, LSA_R_PRIV_GET_DISPNAME *out, prs_struct *ps, int depth)
-{
- if (out == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_r_priv_get_dispname");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_info", ps, depth, &out->ptr_info))
- return False;
-
- if (out->ptr_info){
- if (!smb_io_unihdr("hdr_name", &out->hdr_desc, ps, depth))
- return False;
-
- if (!smb_io_unistr2("desc", &out->desc, out->hdr_desc.buffer, ps, depth))
- return False;
- }
-/*
- if(!prs_align(ps))
- return False;
-*/
- if(!prs_uint16("lang_id", ps, depth, &out->lang_id))
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*
- initialise a LSA_Q_ENUM_ACCOUNTS structure
-*/
-void init_lsa_q_enum_accounts(LSA_Q_ENUM_ACCOUNTS *trn, POLICY_HND *hnd, uint32 enum_context, uint32 pref_max_length)
-{
- memcpy(&trn->pol, hnd, sizeof(trn->pol));
-
- trn->enum_context = enum_context;
- trn->pref_max_length = pref_max_length;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool lsa_io_q_enum_accounts(const char *desc, LSA_Q_ENUM_ACCOUNTS *in, prs_struct *ps, int depth)
-{
- if (in == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_q_enum_accounts");
- depth++;
-
- if (!smb_io_pol_hnd("", &in->pol, ps, depth))
- return False;
-
- if(!prs_uint32("enum_context ", ps, depth, &in->enum_context))
- return False;
- if(!prs_uint32("pref_max_length", ps, depth, &in->pref_max_length))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Inits an LSA_R_ENUM_PRIVS structure.
-********************************************************************/
-
-void init_lsa_r_enum_accounts(LSA_R_ENUM_ACCOUNTS *out, uint32 enum_context)
-{
- DEBUG(5, ("init_lsa_r_enum_accounts\n"));
-
- out->enum_context=enum_context;
- if (out->enum_context!=0) {
- out->sids.num_entries=enum_context;
- out->sids.ptr_sid_enum=1;
- out->sids.num_entries2=enum_context;
- } else {
- out->sids.num_entries=0;
- out->sids.ptr_sid_enum=0;
- out->sids.num_entries2=0;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool lsa_io_r_enum_accounts(const char *desc, LSA_R_ENUM_ACCOUNTS *out, prs_struct *ps, int depth)
-{
- if (out == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_r_enum_accounts");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if(!prs_uint32("enum_context", ps, depth, &out->enum_context))
- return False;
-
- if (!lsa_io_sid_enum("sids", &out->sids, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Reads or writes an LSA_Q_UNK_GET_CONNUSER structure.
-********************************************************************/
-
-bool lsa_io_q_unk_get_connuser(const char *desc, LSA_Q_UNK_GET_CONNUSER *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_unk_get_connuser");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_srvname", ps, depth, &in->ptr_srvname))
- return False;
-
- if(!smb_io_unistr2("uni2_srvname", &in->uni2_srvname, in->ptr_srvname, ps, depth)) /* server name to be looked up */
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if(!prs_uint32("unk1", ps, depth, &in->unk1))
- return False;
- if(!prs_uint32("unk2", ps, depth, &in->unk2))
- return False;
- if(!prs_uint32("unk3", ps, depth, &in->unk3))
- return False;
-
- /* Don't bother to read or write at present... */
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_UNK_GET_CONNUSER structure.
-********************************************************************/
-
-bool lsa_io_r_unk_get_connuser(const char *desc, LSA_R_UNK_GET_CONNUSER *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_unk_get_connuser");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_user_name", ps, depth, &out->ptr_user_name))
- return False;
- if(!smb_io_unihdr("hdr_user_name", &out->hdr_user_name, ps, depth))
- return False;
- if(!smb_io_unistr2("uni2_user_name", &out->uni2_user_name, out->ptr_user_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if(!prs_uint32("unk1", ps, depth, &out->unk1))
- return False;
-
- if(!prs_uint32("ptr_dom_name", ps, depth, &out->ptr_dom_name))
- return False;
- if(!smb_io_unihdr("hdr_dom_name", &out->hdr_dom_name, ps, depth))
- return False;
- if(!smb_io_unistr2("uni2_dom_name", &out->uni2_dom_name, out->ptr_dom_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-void init_lsa_q_create_account(LSA_Q_CREATEACCOUNT *trn, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access)
-{
- memcpy(&trn->pol, hnd, sizeof(trn->pol));
-
- init_dom_sid2(&trn->sid, sid);
- trn->access = desired_access;
-}
-
-
-/*******************************************************************
- Reads or writes an LSA_Q_CREATEACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_q_create_account(const char *desc, LSA_Q_CREATEACCOUNT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_create_account");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
- return False;
-
- if(!smb_io_dom_sid2("sid", &out->sid, ps, depth)) /* domain SID */
- return False;
-
- if(!prs_uint32("access", ps, depth, &out->access))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_CREATEACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_r_create_account(const char *desc, LSA_R_CREATEACCOUNT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_open_account");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-
-void init_lsa_q_open_account(LSA_Q_OPENACCOUNT *trn, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access)
-{
- memcpy(&trn->pol, hnd, sizeof(trn->pol));
-
- init_dom_sid2(&trn->sid, sid);
- trn->access = desired_access;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_OPENACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_q_open_account(const char *desc, LSA_Q_OPENACCOUNT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_open_account");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
- return False;
-
- if(!smb_io_dom_sid2("sid", &out->sid, ps, depth)) /* domain SID */
- return False;
-
- if(!prs_uint32("access", ps, depth, &out->access))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_OPENACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_r_open_account(const char *desc, LSA_R_OPENACCOUNT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_open_account");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-
-void init_lsa_q_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT *trn, POLICY_HND *hnd)
-{
- memcpy(&trn->pol, hnd, sizeof(trn->pol));
-
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_ENUMPRIVSACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_q_enum_privsaccount(const char *desc, LSA_Q_ENUMPRIVSACCOUNT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_enum_privsaccount");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LUID structure.
-********************************************************************/
-
-static bool lsa_io_luid(const char *desc, LUID *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_luid");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("low", ps, depth, &out->low))
- return False;
-
- if(!prs_uint32("high", ps, depth, &out->high))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LUID_ATTR structure.
-********************************************************************/
-
-static bool lsa_io_luid_attr(const char *desc, LUID_ATTR *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_luid_attr");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!lsa_io_luid(desc, &out->luid, ps, depth))
- return False;
-
- if(!prs_uint32("attr", ps, depth, &out->attr))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an PRIVILEGE_SET structure.
-********************************************************************/
-
-static bool lsa_io_privilege_set(const char *desc, PRIVILEGE_SET *out, prs_struct *ps, int depth)
-{
- uint32 i, dummy;
-
- prs_debug(ps, depth, desc, "lsa_io_privilege_set");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("count", ps, depth, &dummy))
- return False;
- if(!prs_uint32("control", ps, depth, &out->control))
- return False;
-
- for (i=0; i<out->count; i++) {
- if (!lsa_io_luid_attr(desc, &out->set[i], ps, depth))
- return False;
- }
-
- return True;
-}
-
-NTSTATUS init_lsa_r_enum_privsaccount(TALLOC_CTX *mem_ctx, LSA_R_ENUMPRIVSACCOUNT *out, LUID_ATTR *set, uint32 count, uint32 control)
-{
- NTSTATUS ret = NT_STATUS_OK;
-
- out->ptr = 1;
- out->count = count;
-
- if ( !NT_STATUS_IS_OK(ret = privilege_set_init_by_ctx(mem_ctx, &(out->set))) )
- return ret;
-
- out->set.count = count;
-
- if (!NT_STATUS_IS_OK(ret = dup_luid_attr(out->set.mem_ctx, &(out->set.set), set, count)))
- return ret;
-
- DEBUG(10,("init_lsa_r_enum_privsaccount: %d privileges\n", out->count));
-
- return ret;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_ENUMPRIVSACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_r_enum_privsaccount(const char *desc, LSA_R_ENUMPRIVSACCOUNT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_enum_privsaccount");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr", ps, depth, &out->ptr))
- return False;
-
- if (out->ptr!=0) {
- if(!prs_uint32("count", ps, depth, &out->count))
- return False;
-
- /* malloc memory if unmarshalling here */
-
- if (UNMARSHALLING(ps) && out->count != 0) {
- if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(out->set))))
- return False;
-
- if (!(out->set.set = PRS_ALLOC_MEM(ps,LUID_ATTR,out->count)))
- return False;
-
- }
-
- if(!lsa_io_privilege_set(desc, &out->set, ps, depth))
- return False;
- }
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-
-
-/*******************************************************************
- Reads or writes an LSA_Q_GETSYSTEMACCOUNTstructure.
-********************************************************************/
-
-bool lsa_io_q_getsystemaccount(const char *desc, LSA_Q_GETSYSTEMACCOUNT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_getsystemaccount");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_GETSYSTEMACCOUNTstructure.
-********************************************************************/
-
-bool lsa_io_r_getsystemaccount(const char *desc, LSA_R_GETSYSTEMACCOUNT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_getsystemaccount");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("access", ps, depth, &out->access))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Reads or writes an LSA_Q_SETSYSTEMACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_q_setsystemaccount(const char *desc, LSA_Q_SETSYSTEMACCOUNT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_setsystemaccount");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
- return False;
-
- if(!prs_uint32("access", ps, depth, &out->access))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_SETSYSTEMACCOUNT structure.
-********************************************************************/
-
-bool lsa_io_r_setsystemaccount(const char *desc, LSA_R_SETSYSTEMACCOUNT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_setsystemaccount");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-
-void init_lsa_string( LSA_STRING *uni, const char *string )
-{
- init_unistr2(&uni->unistring, string, UNI_FLAGS_NONE);
- init_uni_hdr(&uni->hdr, &uni->unistring);
-}
-
-void init_lsa_q_lookup_priv_value(LSA_Q_LOOKUP_PRIV_VALUE *q_u, POLICY_HND *hnd, const char *name)
-{
- memcpy(&q_u->pol, hnd, sizeof(q_u->pol));
- init_lsa_string( &q_u->privname, name );
-}
-
-bool smb_io_lsa_string( const char *desc, LSA_STRING *string, prs_struct *ps, int depth )
-{
- prs_debug(ps, depth, desc, "smb_io_lsa_string");
- depth++;
-
- if(!smb_io_unihdr ("hdr", &string->hdr, ps, depth))
- return False;
- if(!smb_io_unistr2("unistring", &string->unistring, string->hdr.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_LOOKUP_PRIV_VALUE structure.
-********************************************************************/
-
-bool lsa_io_q_lookup_priv_value(const char *desc, LSA_Q_LOOKUP_PRIV_VALUE *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_lookup_priv_value");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
- return False;
- if(!smb_io_lsa_string("privname", &out->privname, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_LOOKUP_PRIV_VALUE structure.
-********************************************************************/
-
-bool lsa_io_r_lookup_priv_value(const char *desc, LSA_R_LOOKUP_PRIV_VALUE *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_lookup_priv_value");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!lsa_io_luid("luid", &out->luid, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Reads or writes an LSA_Q_ADDPRIVS structure.
-********************************************************************/
-
-bool lsa_io_q_addprivs(const char *desc, LSA_Q_ADDPRIVS *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_addprivs");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
- return False;
-
- if(!prs_uint32("count", ps, depth, &out->count))
- return False;
-
- if (UNMARSHALLING(ps) && out->count!=0) {
- if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(out->set))))
- return False;
-
- if (!(out->set.set = PRS_ALLOC_MEM(ps, LUID_ATTR, out->count)))
- return False;
- }
-
- if(!lsa_io_privilege_set(desc, &out->set, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_ADDPRIVS structure.
-********************************************************************/
-
-bool lsa_io_r_addprivs(const char *desc, LSA_R_ADDPRIVS *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_addprivs");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_REMOVEPRIVS structure.
-********************************************************************/
-
-bool lsa_io_q_removeprivs(const char *desc, LSA_Q_REMOVEPRIVS *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_removeprivs");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &out->pol, ps, depth))
- return False;
-
- if(!prs_uint32("allrights", ps, depth, &out->allrights))
- return False;
-
- if(!prs_uint32("ptr", ps, depth, &out->ptr))
- return False;
-
- /*
- * JFM: I'm not sure at all if the count is inside the ptr
- * never seen one with ptr=0
- */
-
- if (out->ptr!=0) {
- if(!prs_uint32("count", ps, depth, &out->count))
- return False;
-
- if (UNMARSHALLING(ps) && out->count!=0) {
- if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps->mem_ctx, &(out->set))))
- return False;
-
- if (!(out->set.set = PRS_ALLOC_MEM(ps, LUID_ATTR, out->count)))
- return False;
- }
-
- if(!lsa_io_privilege_set(desc, &out->set, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_REMOVEPRIVS structure.
-********************************************************************/
-
-bool lsa_io_r_removeprivs(const char *desc, LSA_R_REMOVEPRIVS *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_removeprivs");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-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 );
-}
-
-/*******************************************************************
- Inits an LSA_Q_QUERY_INFO2 structure.
-********************************************************************/
-
-void init_q_query2(LSA_Q_QUERY_INFO2 *in, POLICY_HND *hnd, uint16 info_class)
-{
- DEBUG(5, ("init_q_query2\n"));
-
- memcpy(&in->pol, hnd, sizeof(in->pol));
-
- in->info_class = info_class;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_QUERY_DNSDOMINFO structure.
-********************************************************************/
-
-bool lsa_io_q_query_info2(const char *desc, LSA_Q_QUERY_INFO2 *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_query_info2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &in->pol, ps, depth))
- return False;
-
- if(!prs_uint16("info_class", ps, depth, &in->info_class))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_QUERY_DNSDOMINFO structure.
-********************************************************************/
-
-bool lsa_io_r_query_info2(const char *desc, LSA_R_QUERY_INFO2 *out,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_query_info2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("dom_ptr", ps, depth, &out->dom_ptr))
- return False;
-
- if (out->dom_ptr) {
-
- if(!lsa_io_query_info_ctr2("", ps, depth, &out->ctr))
- return False;
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_Q_ENUM_ACCT_RIGHTS structure.
-********************************************************************/
-void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS *in,
- POLICY_HND *hnd,
- uint32 count,
- DOM_SID *sid)
-{
- DEBUG(5, ("init_q_enum_acct_rights\n"));
-
- in->pol = *hnd;
- init_dom_sid2(&in->sid, sid);
-}
-
-/*******************************************************************
-********************************************************************/
-NTSTATUS init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS *out, PRIVILEGE_SET *privileges )
-{
- uint32 i;
- const char *privname;
- const char **privname_array = NULL;
- int num_priv = 0;
-
- for ( i=0; i<privileges->count; i++ ) {
- privname = luid_to_privilege_name( &privileges->set[i].luid );
- if ( privname ) {
- if ( !add_string_to_array( talloc_tos(), privname, &privname_array, &num_priv ) )
- return NT_STATUS_NO_MEMORY;
- }
- }
-
- if ( num_priv ) {
- out->rights = TALLOC_P( talloc_tos(), UNISTR4_ARRAY );
- if (!out->rights) {
- return NT_STATUS_NO_MEMORY;
- }
-
- if ( !init_unistr4_array( out->rights, num_priv, privname_array ) )
- return NT_STATUS_NO_MEMORY;
-
- out->count = num_priv;
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
-reads or writes a LSA_Q_ENUM_ACCT_RIGHTS structure.
-********************************************************************/
-bool lsa_io_q_enum_acct_rights(const char *desc, LSA_Q_ENUM_ACCT_RIGHTS *in, prs_struct *ps, int depth)
-{
-
- if (in == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_q_enum_acct_rights");
- depth++;
-
- if (!smb_io_pol_hnd("", &in->pol, ps, depth))
- return False;
-
- if(!smb_io_dom_sid2("sid", &in->sid, ps, depth))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-reads or writes a LSA_R_ENUM_ACCT_RIGHTS structure.
-********************************************************************/
-bool lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_enum_acct_rights");
- depth++;
-
- if(!prs_uint32("count ", ps, depth, &out->count))
- return False;
-
- if ( !prs_pointer("rights", ps, depth, (void*)&out->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) )
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Inits an LSA_Q_ADD_ACCT_RIGHTS structure.
-********************************************************************/
-void init_q_add_acct_rights( LSA_Q_ADD_ACCT_RIGHTS *in, POLICY_HND *hnd,
- DOM_SID *sid, uint32 count, const char **rights )
-{
- DEBUG(5, ("init_q_add_acct_rights\n"));
-
- in->pol = *hnd;
- init_dom_sid2(&in->sid, sid);
-
- in->rights = TALLOC_P( talloc_tos(), UNISTR4_ARRAY );
- if (!in->rights) {
- smb_panic("init_q_add_acct_rights: talloc fail\n");
- return;
- }
- init_unistr4_array( in->rights, count, rights );
-
- in->count = count;
-}
-
-
-/*******************************************************************
-reads or writes a LSA_Q_ADD_ACCT_RIGHTS structure.
-********************************************************************/
-bool lsa_io_q_add_acct_rights(const char *desc, LSA_Q_ADD_ACCT_RIGHTS *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_add_acct_rights");
- depth++;
-
- if (!smb_io_pol_hnd("", &in->pol, ps, depth))
- return False;
-
- if(!smb_io_dom_sid2("sid", &in->sid, ps, depth))
- return False;
-
- if(!prs_uint32("count", ps, depth, &in->count))
- return False;
-
- if ( !prs_pointer("rights", ps, depth, (void*)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) )
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a LSA_R_ENUM_ACCT_RIGHTS structure.
-********************************************************************/
-bool lsa_io_r_add_acct_rights(const char *desc, LSA_R_ADD_ACCT_RIGHTS *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_add_acct_rights");
- depth++;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_Q_REMOVE_ACCT_RIGHTS structure.
-********************************************************************/
-
-void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS *in,
- POLICY_HND *hnd,
- DOM_SID *sid,
- uint32 removeall,
- uint32 count,
- const char **rights)
-{
- DEBUG(5, ("init_q_remove_acct_rights\n"));
-
- in->pol = *hnd;
-
- init_dom_sid2(&in->sid, sid);
-
- in->removeall = removeall;
- in->count = count;
-
- in->rights = TALLOC_P( talloc_tos(), UNISTR4_ARRAY );
- if (!in->rights) {
- smb_panic("init_q_remove_acct_rights: talloc fail\n");
- return;
- }
- init_unistr4_array( in->rights, count, rights );
-}
-
-/*******************************************************************
-reads or writes a LSA_Q_REMOVE_ACCT_RIGHTS structure.
-********************************************************************/
-
-bool lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_remove_acct_rights");
- depth++;
-
- if (!smb_io_pol_hnd("", &in->pol, ps, depth))
- return False;
-
- if(!smb_io_dom_sid2("sid", &in->sid, ps, depth))
- return False;
-
- if(!prs_uint32("removeall", ps, depth, &in->removeall))
- return False;
-
- if(!prs_uint32("count", ps, depth, &in->count))
- return False;
-
- if ( !prs_pointer("rights", ps, depth, (void*)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) )
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a LSA_R_ENUM_ACCT_RIGHTS structure.
-********************************************************************/
-bool lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_remove_acct_rights");
- depth++;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_Q_OPEN_TRUSTED_DOMAIN structure.
-********************************************************************/
-
-void init_lsa_q_open_trusted_domain(LSA_Q_OPEN_TRUSTED_DOMAIN *q, POLICY_HND *hnd, DOM_SID *sid, uint32 desired_access)
-{
- memcpy(&q->pol, hnd, sizeof(q->pol));
-
- init_dom_sid2(&q->sid, sid);
- q->access_mask = desired_access;
-}
-
-/*******************************************************************
-********************************************************************/
-
-#if 0 /* jerry, I think this not correct - gd */
-bool lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!smb_io_pol_hnd("", &in->handle, ps, depth))
- return False;
-
- if(!prs_uint32("count", ps, depth, &in->count))
- return False;
-
- if(!smb_io_dom_sid("sid", &in->sid, ps, depth))
- return False;
-
- return True;
-}
-#endif
-
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *q_o, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_o->pol, ps, depth))
- return False;
-
- if(!smb_io_dom_sid2("sid", &q_o->sid, ps, depth))
- return False;
-
- if(!prs_uint32("access", ps, depth, &q_o->access_mask))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_OPEN_TRUSTED_DOMAIN structure.
-********************************************************************/
-
-bool lsa_io_r_open_trusted_domain(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_open_trusted_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!smb_io_pol_hnd("handle", &out->handle, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_q_create_trusted_domain(const char *desc, LSA_Q_CREATE_TRUSTED_DOMAIN *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_create_trusted_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("", &in->handle, ps, depth))
- return False;
-
- if(!prs_unistr4 ("secretname", ps, depth, &in->secretname))
- return False;
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("access", ps, depth, &in->access))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_r_create_trusted_domain(const char *desc, LSA_R_CREATE_TRUSTED_DOMAIN *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_create_trusted_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!smb_io_pol_hnd("", &out->handle, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_q_create_secret(const char *desc, LSA_Q_CREATE_SECRET *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_create_secret");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("", &in->handle, ps, depth))
- return False;
-
- if(!prs_unistr4 ("secretname", ps, depth, &in->secretname))
- return False;
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("access", ps, depth, &in->access))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_r_create_secret(const char *desc, LSA_R_CREATE_SECRET *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_create_secret");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!smb_io_pol_hnd("", &out->handle, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-
-
-/*******************************************************************
-********************************************************************/
-
-static bool lsa_io_data_blob( const char *desc, prs_struct *ps, int depth, LSA_DATA_BLOB *blob )
-{
- prs_debug(ps, depth, desc, "lsa_io_data_blob");
- depth++;
-
- if ( !prs_uint32("size", ps, depth, &blob->size) )
- return False;
- if ( !prs_uint32("size", ps, depth, &blob->size) )
- return False;
-
- if ( !prs_io_unistr2_p(desc, ps, depth, &blob->data) )
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_q_set_secret(const char *desc, LSA_Q_SET_SECRET *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_set_secret");
- depth++;
-
- if ( !prs_align(ps) )
- return False;
-
- if ( !smb_io_pol_hnd("", &in->handle, ps, depth) )
- return False;
-
- if ( !prs_pointer( "old_value", ps, depth, (void*)&in->old_value, sizeof(LSA_DATA_BLOB), (PRS_POINTER_CAST)lsa_io_data_blob ))
- return False;
-
- if( !prs_align(ps) )
- return False;
- if ( !prs_pointer( "old_value", ps, depth, (void*)&in->old_value, sizeof(LSA_DATA_BLOB), (PRS_POINTER_CAST)lsa_io_data_blob ))
- return False;
-
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_r_set_secret(const char *desc, LSA_R_SET_SECRET *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_set_secret");
- depth++;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_q_delete_object(const char *desc, LSA_Q_DELETE_OBJECT *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_delete_object");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("", &in->handle, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_delete_object");
- depth++;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_Q_QUERY_DOM_INFO_POLICY structure.
-********************************************************************/
-
-void init_q_query_dom_info(LSA_Q_QUERY_DOM_INFO_POLICY *in, POLICY_HND *hnd, uint16 info_class)
-{
- DEBUG(5, ("init_q_query_dom_info\n"));
-
- memcpy(&in->pol, hnd, sizeof(in->pol));
-
- in->info_class = info_class;
-}
-
-/*******************************************************************
- Reads or writes an LSA_Q_QUERY_DOM_INFO_POLICY structure.
-********************************************************************/
-
-bool lsa_io_q_query_dom_info(const char *desc, LSA_Q_QUERY_DOM_INFO_POLICY *in, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_q_query_dom_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &in->pol, ps, depth))
- return False;
-
- if(!prs_uint16("info_class", ps, depth, &in->info_class))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an LSA_R_QUERY_DOM_INFO_POLICY structure.
-********************************************************************/
-
-static bool lsa_io_dominfo_query_3(const char *desc, LSA_DOM_INFO_POLICY_KERBEROS *krb_policy,
- prs_struct *ps, int depth)
-{
- if (!prs_align_uint64(ps))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("enforce_restrictions", ps, depth, &krb_policy->enforce_restrictions))
- return False;
-
- if (!prs_align_uint64(ps))
- return False;
-
- if (!smb_io_nttime("service_tkt_lifetime", ps, depth, &krb_policy->service_tkt_lifetime))
- return False;
-
- if (!prs_align_uint64(ps))
- return False;
-
- if (!smb_io_nttime("user_tkt_lifetime", ps, depth, &krb_policy->user_tkt_lifetime))
- return False;
-
- if (!prs_align_uint64(ps))
- return False;
-
- if (!smb_io_nttime("user_tkt_renewaltime", ps, depth, &krb_policy->user_tkt_renewaltime))
- return False;
-
- if (!prs_align_uint64(ps))
- return False;
-
- if (!smb_io_nttime("clock_skew", ps, depth, &krb_policy->clock_skew))
- return False;
-
- if (!prs_align_uint64(ps))
- return False;
-
- if (!smb_io_nttime("unknown6", ps, depth, &krb_policy->unknown6))
- return False;
-
- return True;
-}
-
-static bool lsa_io_dom_info_query(const char *desc, prs_struct *ps, int depth, LSA_DOM_INFO_UNION *info)
-{
- prs_debug(ps, depth, desc, "lsa_io_dom_info_query");
- depth++;
-
- if(!prs_align_uint16(ps))
- return False;
-
- if(!prs_uint16("info_class", ps, depth, &info->info_class))
- return False;
-
- switch (info->info_class) {
- case 3:
- if (!lsa_io_dominfo_query_3("krb_policy", &info->krb_policy, ps, depth))
- return False;
- break;
- default:
- DEBUG(0,("unsupported info-level: %d\n", info->info_class));
- return False;
- break;
- }
-
- return True;
-}
-
-
-bool lsa_io_r_query_dom_info(const char *desc, LSA_R_QUERY_DOM_INFO_POLICY *out,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "lsa_io_r_query_dom_info");
- depth++;
-
- if (!prs_pointer("dominfo", ps, depth, (void*)&out->info,
- sizeof(LSA_DOM_INFO_UNION),
- (PRS_POINTER_CAST)lsa_io_dom_info_query) )
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return 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 65607a4ac8..0000000000
--- a/source3/rpc_parse/parse_net.c
+++ /dev/null
@@ -1,3930 +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 a NETLOGON_INFO_3 structure.
-********************************************************************/
-
-static void init_netinfo_3(NETLOGON_INFO_3 *info, uint32 flags, uint32 logon_attempts)
-{
- info->flags = flags;
- info->logon_attempts = logon_attempts;
- info->reserved_1 = 0x0;
- info->reserved_2 = 0x0;
- info->reserved_3 = 0x0;
- info->reserved_4 = 0x0;
- info->reserved_5 = 0x0;
-}
-
-/*******************************************************************
- Reads or writes a NETLOGON_INFO_3 structure.
-********************************************************************/
-
-static bool net_io_netinfo_3(const char *desc, NETLOGON_INFO_3 *info, prs_struct *ps, int depth)
-{
- if (info == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_netinfo_3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("flags ", ps, depth, &info->flags))
- return False;
- if(!prs_uint32("logon_attempts", ps, depth, &info->logon_attempts))
- return False;
- if(!prs_uint32("reserved_1 ", ps, depth, &info->reserved_1))
- return False;
- if(!prs_uint32("reserved_2 ", ps, depth, &info->reserved_2))
- return False;
- if(!prs_uint32("reserved_3 ", ps, depth, &info->reserved_3))
- return False;
- if(!prs_uint32("reserved_4 ", ps, depth, &info->reserved_4))
- return False;
- if(!prs_uint32("reserved_5 ", ps, depth, &info->reserved_5))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Inits a NETLOGON_INFO_1 structure.
-********************************************************************/
-
-static void init_netinfo_1(NETLOGON_INFO_1 *info, uint32 flags, uint32 pdc_status)
-{
- info->flags = flags;
- info->pdc_status = pdc_status;
-}
-
-/*******************************************************************
- Reads or writes a NETLOGON_INFO_1 structure.
-********************************************************************/
-
-static bool net_io_netinfo_1(const char *desc, NETLOGON_INFO_1 *info, prs_struct *ps, int depth)
-{
- if (info == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_netinfo_1");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("flags ", ps, depth, &info->flags))
- return False;
- if(!prs_uint32("pdc_status", ps, depth, &info->pdc_status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a NETLOGON_INFO_2 structure.
-********************************************************************/
-
-static void init_netinfo_2(NETLOGON_INFO_2 *info, uint32 flags, uint32 pdc_status,
- uint32 tc_status, const char *trusted_dc_name)
-{
- info->flags = flags;
- info->pdc_status = pdc_status;
- info->ptr_trusted_dc_name = 1;
- info->tc_status = tc_status;
-
- if (trusted_dc_name != NULL)
- init_unistr2(&info->uni_trusted_dc_name, trusted_dc_name, UNI_STR_TERMINATE);
- else
- init_unistr2(&info->uni_trusted_dc_name, "", UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes a NETLOGON_INFO_2 structure.
-********************************************************************/
-
-static bool net_io_netinfo_2(const char *desc, NETLOGON_INFO_2 *info, prs_struct *ps, int depth)
-{
- if (info == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_netinfo_2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("flags ", ps, depth, &info->flags))
- return False;
- if(!prs_uint32("pdc_status ", ps, depth, &info->pdc_status))
- return False;
- if(!prs_uint32("ptr_trusted_dc_name", ps, depth, &info->ptr_trusted_dc_name))
- return False;
- if(!prs_uint32("tc_status ", ps, depth, &info->tc_status))
- return False;
-
- if (info->ptr_trusted_dc_name != 0) {
- if(!smb_io_unistr2("unistr2", &info->uni_trusted_dc_name, info->ptr_trusted_dc_name, ps, depth))
- return False;
- }
-
- if(!prs_align(ps))
- return False;
-
- return True;
-}
-
-static bool net_io_ctrl_data_info_5(const char *desc, CTRL_DATA_INFO_5 *info, prs_struct *ps, int depth)
-{
- if (info == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_ctrl_data_info_5");
- depth++;
-
- if ( !prs_uint32( "function_code", ps, depth, &info->function_code ) )
- return False;
-
- if(!prs_uint32("ptr_domain", ps, depth, &info->ptr_domain))
- return False;
-
- if ( info->ptr_domain ) {
- if(!smb_io_unistr2("domain", &info->domain, info->ptr_domain, ps, depth))
- return False;
- }
-
- return True;
-}
-
-static bool net_io_ctrl_data_info_6(const char *desc, CTRL_DATA_INFO_6 *info, prs_struct *ps, int depth)
-{
- if (info == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_ctrl_data_info_6");
- depth++;
-
- if ( !prs_uint32( "function_code", ps, depth, &info->function_code ) )
- return False;
-
- if(!prs_uint32("ptr_domain", ps, depth, &info->ptr_domain))
- return False;
-
- if ( info->ptr_domain ) {
- if(!smb_io_unistr2("domain", &info->domain, info->ptr_domain, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_LOGON_CTRL2 structure.
-********************************************************************/
-
-bool net_io_q_logon_ctrl2(const char *desc, NET_Q_LOGON_CTRL2 *q_l, prs_struct *ps, int depth)
-{
- if (q_l == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_logon_ctrl2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr ", ps, depth, &q_l->ptr))
- return False;
-
- if(!smb_io_unistr2 ("", &q_l->uni_server_name, q_l->ptr, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("function_code", ps, depth, &q_l->function_code))
- return False;
- if(!prs_uint32("query_level ", ps, depth, &q_l->query_level))
- return False;
- switch ( q_l->function_code ) {
- case NETLOGON_CONTROL_REDISCOVER:
- if ( !net_io_ctrl_data_info_5( "ctrl_data_info5", &q_l->info.info5, ps, depth) )
- return False;
- break;
-
- case NETLOGON_CONTROL_TC_QUERY:
- if ( !net_io_ctrl_data_info_6( "ctrl_data_info6", &q_l->info.info6, ps, depth) )
- return False;
- break;
-
- default:
- DEBUG(0,("net_io_q_logon_ctrl2: unknown function_code [%d]\n",
- q_l->function_code));
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- Inits an NET_Q_LOGON_CTRL2 structure.
-********************************************************************/
-
-void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2 *q_l, const char *srv_name,
- uint32 query_level)
-{
- DEBUG(5,("init_q_logon_ctrl2\n"));
-
- q_l->function_code = 0x01;
- q_l->query_level = query_level;
-
- init_unistr2(&q_l->uni_server_name, srv_name, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Inits an NET_R_LOGON_CTRL2 structure.
-********************************************************************/
-
-void init_net_r_logon_ctrl2(NET_R_LOGON_CTRL2 *r_l, uint32 query_level,
- uint32 flags, uint32 pdc_status,
- uint32 logon_attempts, uint32 tc_status,
- const char *trusted_domain_name)
-{
- r_l->switch_value = query_level;
-
- switch (query_level) {
- case 1:
- r_l->ptr = 1; /* undocumented pointer */
- init_netinfo_1(&r_l->logon.info1, flags, pdc_status);
- r_l->status = NT_STATUS_OK;
- break;
- case 2:
- r_l->ptr = 1; /* undocumented pointer */
- init_netinfo_2(&r_l->logon.info2, flags, pdc_status,
- tc_status, trusted_domain_name);
- r_l->status = NT_STATUS_OK;
- break;
- case 3:
- r_l->ptr = 1; /* undocumented pointer */
- init_netinfo_3(&r_l->logon.info3, flags, logon_attempts);
- r_l->status = NT_STATUS_OK;
- break;
- default:
- DEBUG(2,("init_r_logon_ctrl2: unsupported switch value %d\n",
- r_l->switch_value));
- r_l->ptr = 0; /* undocumented pointer */
-
- /* take a guess at an error code... */
- r_l->status = NT_STATUS_INVALID_INFO_CLASS;
- break;
- }
-}
-
-/*******************************************************************
- Reads or writes an NET_R_LOGON_CTRL2 structure.
-********************************************************************/
-
-bool net_io_r_logon_ctrl2(const char *desc, NET_R_LOGON_CTRL2 *r_l, prs_struct *ps, int depth)
-{
- if (r_l == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_logon_ctrl2");
- depth++;
-
- if(!prs_uint32("switch_value ", ps, depth, &r_l->switch_value))
- return False;
- if(!prs_uint32("ptr ", ps, depth, &r_l->ptr))
- return False;
-
- if (r_l->ptr != 0) {
- switch (r_l->switch_value) {
- case 1:
- if(!net_io_netinfo_1("", &r_l->logon.info1, ps, depth))
- return False;
- break;
- case 2:
- if(!net_io_netinfo_2("", &r_l->logon.info2, ps, depth))
- return False;
- break;
- case 3:
- if(!net_io_netinfo_3("", &r_l->logon.info3, ps, depth))
- return False;
- break;
- default:
- DEBUG(2,("net_io_r_logon_ctrl2: unsupported switch value %d\n",
- r_l->switch_value));
- break;
- }
- }
-
- if(!prs_ntstatus("status ", ps, depth, &r_l->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_LOGON_CTRL structure.
-********************************************************************/
-
-bool net_io_q_logon_ctrl(const char *desc, NET_Q_LOGON_CTRL *q_l, prs_struct *ps,
- int depth)
-{
- prs_debug(ps, depth, desc, "net_io_q_logon_ctrl");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr ", ps, depth, &q_l->ptr))
- return False;
-
- if(!smb_io_unistr2 ("", &q_l->uni_server_name, q_l->ptr, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("function_code", ps, depth, &q_l->function_code))
- return False;
- if(!prs_uint32("query_level ", ps, depth, &q_l->query_level))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an NET_Q_LOGON_CTRL structure.
-********************************************************************/
-
-void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL *q_l, const char *srv_name,
- uint32 query_level)
-{
- DEBUG(5,("init_q_logon_ctrl\n"));
-
- q_l->function_code = 0x01; /* ??? */
- q_l->query_level = query_level;
-
- init_unistr2(&q_l->uni_server_name, srv_name, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Inits an NET_R_LOGON_CTRL structure.
-********************************************************************/
-
-void init_net_r_logon_ctrl(NET_R_LOGON_CTRL *r_l, uint32 query_level,
- uint32 flags, uint32 pdc_status)
-{
- DEBUG(5,("init_r_logon_ctrl\n"));
-
- r_l->switch_value = query_level; /* should only be 0x1 */
-
- switch (query_level) {
- case 1:
- r_l->ptr = 1; /* undocumented pointer */
- init_netinfo_1(&r_l->logon.info1, flags, pdc_status);
- r_l->status = NT_STATUS_OK;
- break;
- default:
- DEBUG(2,("init_r_logon_ctrl: unsupported switch value %d\n",
- r_l->switch_value));
- r_l->ptr = 0; /* undocumented pointer */
-
- /* take a guess at an error code... */
- r_l->status = NT_STATUS_INVALID_INFO_CLASS;
- break;
- }
-}
-
-/*******************************************************************
- Reads or writes an NET_R_LOGON_CTRL structure.
-********************************************************************/
-
-bool net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps,
- int depth)
-{
- prs_debug(ps, depth, desc, "net_io_r_logon_ctrl");
- depth++;
-
- if(!prs_uint32("switch_value ", ps, depth, &r_l->switch_value))
- return False;
- if(!prs_uint32("ptr ", ps, depth, &r_l->ptr))
- return False;
-
- if (r_l->ptr != 0) {
- switch (r_l->switch_value) {
- case 1:
- if(!net_io_netinfo_1("", &r_l->logon.info1, ps, depth))
- return False;
- break;
- default:
- DEBUG(2,("net_io_r_logon_ctrl: unsupported switch value %d\n",
- r_l->switch_value));
- break;
- }
- }
-
- if(!prs_ntstatus("status ", ps, depth, &r_l->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an NET_R_GETANYDCNAME structure.
-********************************************************************/
-void init_net_q_getanydcname(NET_Q_GETANYDCNAME *r_t, const char *logon_server,
- const char *domainname)
-{
- DEBUG(5,("init_q_getanydcname\n"));
-
- r_t->ptr_logon_server = (logon_server != NULL);
- init_unistr2(&r_t->uni_logon_server, logon_server, UNI_STR_TERMINATE);
- r_t->ptr_domainname = (domainname != NULL);
- init_unistr2(&r_t->uni_domainname, domainname, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_GETANYDCNAME structure.
-********************************************************************/
-
-bool net_io_q_getanydcname(const char *desc, NET_Q_GETANYDCNAME *r_t, prs_struct *ps,
- int depth)
-{
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_getanydcname");
- depth++;
-
- if (!prs_uint32("ptr_logon_server", ps, depth, &r_t->ptr_logon_server))
- return False;
-
- if (!smb_io_unistr2("logon_server", &r_t->uni_logon_server,
- r_t->ptr_logon_server, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_domainname", ps, depth, &r_t->ptr_domainname))
- return False;
-
- if (!smb_io_unistr2("domainname", &r_t->uni_domainname,
- r_t->ptr_domainname, ps, depth))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Inits an NET_R_GETANYDCNAME structure.
-********************************************************************/
-void init_net_r_getanydcname(NET_R_GETANYDCNAME *r_t, const char *dcname)
-{
- DEBUG(5,("init_r_getanydcname\n"));
-
- init_unistr2(&r_t->uni_dcname, dcname, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes an NET_R_GETANYDCNAME structure.
-********************************************************************/
-
-bool net_io_r_getanydcname(const char *desc, NET_R_GETANYDCNAME *r_t, prs_struct *ps,
- int depth)
-{
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_getanydcname");
- depth++;
-
- if (!prs_uint32("ptr_dcname", ps, depth, &r_t->ptr_dcname))
- return False;
-
- if (!smb_io_unistr2("dcname", &r_t->uni_dcname,
- r_t->ptr_dcname, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_werror("status", ps, depth, &r_t->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Inits an NET_R_GETDCNAME structure.
-********************************************************************/
-void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server,
- const char *domainname)
-{
- DEBUG(5,("init_q_getdcname\n"));
-
- init_unistr2(&r_t->uni_logon_server, logon_server, UNI_STR_TERMINATE);
- r_t->ptr_domainname = (domainname != NULL);
- init_unistr2(&r_t->uni_domainname, domainname, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_GETDCNAME structure.
-********************************************************************/
-
-bool net_io_q_getdcname(const char *desc, NET_Q_GETDCNAME *r_t, prs_struct *ps,
- int depth)
-{
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_getdcname");
- depth++;
-
- if (!smb_io_unistr2("logon_server", &r_t->uni_logon_server,
- 1, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_domainname", ps, depth, &r_t->ptr_domainname))
- return False;
-
- if (!smb_io_unistr2("domainname", &r_t->uni_domainname,
- r_t->ptr_domainname, ps, depth))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
- Inits an NET_R_GETDCNAME structure.
-********************************************************************/
-void init_net_r_getdcname(NET_R_GETDCNAME *r_t, const char *dcname)
-{
- DEBUG(5,("init_r_getdcname\n"));
-
- init_unistr2(&r_t->uni_dcname, dcname, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes an NET_R_GETDCNAME structure.
-********************************************************************/
-
-bool net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps,
- int depth)
-{
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_getdcname");
- depth++;
-
- if (!prs_uint32("ptr_dcname", ps, depth, &r_t->ptr_dcname))
- return False;
-
- if (!smb_io_unistr2("dcname", &r_t->uni_dcname,
- r_t->ptr_dcname, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_werror("status", ps, depth, &r_t->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an NET_R_TRUST_DOM_LIST structure.
-********************************************************************/
-
-void init_r_trust_dom(NET_R_TRUST_DOM_LIST *r_t,
- uint32 num_doms, const char *dom_name)
-{
- unsigned int i = 0;
-
- DEBUG(5,("init_r_trust_dom\n"));
-
- for (i = 0; i < MAX_TRUST_DOMS; i++) {
- r_t->uni_trust_dom_name[i].uni_str_len = 0;
- r_t->uni_trust_dom_name[i].uni_max_len = 0;
- }
- if (num_doms > MAX_TRUST_DOMS)
- num_doms = MAX_TRUST_DOMS;
-
- for (i = 0; i < num_doms; i++) {
- fstring domain_name;
- fstrcpy(domain_name, dom_name);
- strupper_m(domain_name);
- init_unistr2(&r_t->uni_trust_dom_name[i], domain_name, UNI_STR_TERMINATE);
- /* the use of UNISTR2 here is non-standard. */
- r_t->uni_trust_dom_name[i].offset = 0x1;
- }
-
- r_t->status = NT_STATUS_OK;
-}
-
-/*******************************************************************
- Reads or writes an NET_R_TRUST_DOM_LIST structure.
-********************************************************************/
-
-bool net_io_r_trust_dom(const char *desc, NET_R_TRUST_DOM_LIST *r_t, prs_struct *ps, int depth)
-{
- uint32 value;
-
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_trust_dom");
- depth++;
-
- /* temporary code to give a valid response */
- value=2;
- if(!prs_uint32("status", ps, depth, &value))
- return False;
-
- value=1;
- if(!prs_uint32("status", ps, depth, &value))
- return False;
- value=2;
- if(!prs_uint32("status", ps, depth, &value))
- return False;
-
- value=0;
- if(!prs_uint32("status", ps, depth, &value))
- return False;
-
- value=0;
- if(!prs_uint32("status", ps, depth, &value))
- return False;
-
-/* old non working code */
-#if 0
- int i;
-
- for (i = 0; i < MAX_TRUST_DOMS; i++) {
- if (r_t->uni_trust_dom_name[i].uni_str_len == 0)
- break;
- if(!smb_io_unistr2("", &r_t->uni_trust_dom_name[i], True, ps, depth))
- return False;
- }
-
- if(!prs_ntstatus("status", ps, depth, &r_t->status))
- return False;
-#endif
- return True;
-}
-
-
-/*******************************************************************
- Reads or writes an NET_Q_TRUST_DOM_LIST structure.
-********************************************************************/
-
-bool net_io_q_trust_dom(const char *desc, NET_Q_TRUST_DOM_LIST *q_l, prs_struct *ps, int depth)
-{
- if (q_l == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_trust_dom");
- depth++;
-
- if(!prs_uint32("ptr ", ps, depth, &q_l->ptr))
- return False;
- if(!smb_io_unistr2 ("", &q_l->uni_server_name, q_l->ptr, ps, depth))
- 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_PWEXPIRED) {
- DEBUGADD(lvl,("\taccount has ACB_PWEXPIRED set\n"));
- }
-}
-
-static void dump_user_flgs(uint32 user_flags) {
-
- int lvl = 10;
- DEBUG(lvl,("dump_user_flgs\n"));
- if (user_flags & LOGON_EXTRA_SIDS) {
- DEBUGADD(lvl,("\taccount has LOGON_EXTRA_SIDS\n"));
- }
- if (user_flags & LOGON_RESOURCE_GROUPS) {
- DEBUGADD(lvl,("\taccount has LOGON_RESOURCE_GROUPS\n"));
- }
- if (user_flags & LOGON_NTLMV2_ENABLED) {
- DEBUGADD(lvl,("\taccount has LOGON_NTLMV2_ENABLED\n"));
- }
- if (user_flags & LOGON_CACHED_ACCOUNT) {
- DEBUGADD(lvl,("\taccount has LOGON_CACHED_ACCOUNT\n"));
- }
- if (user_flags & LOGON_PROFILE_PATH_RETURNED) {
- DEBUGADD(lvl,("\taccount has LOGON_PROFILE_PATH_RETURNED\n"));
- }
- if (user_flags & LOGON_SERVER_TRUST_ACCOUNT) {
- DEBUGADD(lvl,("\taccount has LOGON_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 & LOGON_EXTRA_SIDS)) {
- DEBUG(10,("net_io_user_info3: user_flgs attribute does not have LOGON_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;
-}
-
-/*******************************************************************
-makes a NET_Q_SAM_SYNC structure.
-********************************************************************/
-bool init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name,
- const char *cli_name, DOM_CRED *cli_creds,
- DOM_CRED *ret_creds, uint32 database_id,
- uint32 next_rid)
-{
- DEBUG(5, ("init_q_sam_sync\n"));
-
- init_unistr2(&q_s->uni_srv_name, srv_name, UNI_STR_TERMINATE);
- init_unistr2(&q_s->uni_cli_name, cli_name, UNI_STR_TERMINATE);
-
- if (cli_creds)
- memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds));
-
- if (cli_creds)
- memcpy(&q_s->ret_creds, ret_creds, sizeof(q_s->ret_creds));
- else
- memset(&q_s->ret_creds, 0, sizeof(q_s->ret_creds));
-
- q_s->database_id = database_id;
- q_s->restart_state = 0;
- q_s->sync_context = next_rid;
- q_s->max_size = 0xffff;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool net_io_q_sam_sync(const char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps,
- int depth)
-{
- prs_debug(ps, depth, desc, "net_io_q_sam_sync");
- depth++;
-
- if (!smb_io_unistr2("", &q_s->uni_srv_name, True, ps, depth))
- return False;
- if (!smb_io_unistr2("", &q_s->uni_cli_name, True, ps, depth))
- return False;
-
- if (!smb_io_cred("", &q_s->cli_creds, ps, depth))
- return False;
- if (!smb_io_cred("", &q_s->ret_creds, ps, depth))
- return False;
-
- if (!prs_uint32("database_id ", ps, depth, &q_s->database_id))
- return False;
- if (!prs_uint32("restart_state", ps, depth, &q_s->restart_state))
- return False;
- if (!prs_uint32("sync_context ", ps, depth, &q_s->sync_context))
- return False;
-
- if (!prs_uint32("max_size", ps, depth, &q_s->max_size))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_delta_hdr(const char *desc, SAM_DELTA_HDR * delta,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "net_io_sam_delta_hdr");
- depth++;
-
- if (!prs_uint16("type", ps, depth, &delta->type))
- return False;
- if (!prs_uint16("type2", ps, depth, &delta->type2))
- return False;
- if (!prs_uint32("target_rid", ps, depth, &delta->target_rid))
- return False;
-
- if (!prs_uint32("type3", ps, depth, &delta->type3))
- return False;
-
- /* Not sure why we need this but it seems to be necessary to get
- sam deltas working. */
-
- if (delta->type != 0x16) {
- if (!prs_uint32("ptr_delta", ps, depth, &delta->ptr_delta))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_delta_mod_count(const char *desc, SAM_DELTA_MOD_COUNT *info,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "net_io_sam_delta_stamp");
- depth++;
-
- if (!prs_uint32("seqnum", ps, depth, &info->seqnum))
- return False;
- if (!prs_uint32("dom_mod_count_ptr", ps, depth,
- &info->dom_mod_count_ptr))
- return False;
-
- if (info->dom_mod_count_ptr) {
- if (!prs_uint64("dom_mod_count", ps, depth,
- &info->dom_mod_count))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "net_io_sam_domain_info");
- depth++;
-
- if (!smb_io_unihdr("hdr_dom_name", &info->hdr_dom_name, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_oem_info", &info->hdr_oem_info, ps, depth))
- return False;
-
- if (!prs_uint64("force_logoff", ps, depth, &info->force_logoff))
- return False;
- if (!prs_uint16("min_pwd_len", ps, depth, &info->min_pwd_len))
- return False;
- if (!prs_uint16("pwd_history_len", ps, depth, &info->pwd_history_len))
- return False;
- if (!prs_uint64("max_pwd_age", ps, depth, &info->max_pwd_age))
- return False;
- if (!prs_uint64("min_pwd_age", ps, depth, &info->min_pwd_age))
- return False;
- if (!prs_uint64("dom_mod_count", ps, depth, &info->dom_mod_count))
- return False;
- if (!smb_io_time("creation_time", &info->creation_time, ps, depth))
- return False;
- if (!prs_uint32("security_information", ps, depth, &info->security_information))
- return False;
- if (!smb_io_bufhdr4("hdr_sec_desc", &info->hdr_sec_desc, ps, depth))
- return False;
- if (!smb_io_lockout_string_hdr("hdr_account_lockout_string", &info->hdr_account_lockout, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_unknown2", &info->hdr_unknown2, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_unknown3", &info->hdr_unknown3, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_unknown4", &info->hdr_unknown4, ps, depth))
- return False;
- if (!prs_uint32("logon_chgpass", ps, depth, &info->logon_chgpass))
- return False;
- if (!prs_uint32("unknown6", ps, depth, &info->unknown6))
- return False;
- if (!prs_uint32("unknown7", ps, depth, &info->unknown7))
- return False;
- if (!prs_uint32("unknown8", ps, depth, &info->unknown8))
- return False;
-
- if (!smb_io_unistr2("uni_dom_name", &info->uni_dom_name,
- info->hdr_dom_name.buffer, ps, depth))
- return False;
- if (!smb_io_unistr2("buf_oem_info", &info->buf_oem_info,
- info->hdr_oem_info.buffer, ps, depth))
- return False;
-
- if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
- return False;
-
- if (!smb_io_account_lockout_str("account_lockout", &info->account_lockout,
- info->hdr_account_lockout.buffer, ps, depth))
- return False;
-
- if (!smb_io_unistr2("buf_unknown2", &info->buf_unknown2,
- info->hdr_unknown2.buffer, ps, depth))
- return False;
- if (!smb_io_unistr2("buf_unknown3", &info->buf_unknown3,
- info->hdr_unknown3.buffer, ps, depth))
- return False;
- if (!smb_io_unistr2("buf_unknown4", &info->buf_unknown4,
- info->hdr_unknown4.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "net_io_sam_group_info");
- depth++;
-
- if (!smb_io_unihdr("hdr_grp_name", &info->hdr_grp_name, ps, depth))
- return False;
- if (!smb_io_gid("gid", &info->gid, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_grp_desc", &info->hdr_grp_desc, ps, depth))
- return False;
- if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth))
- return False;
-
- if (ps->data_offset + 48 > ps->buffer_size)
- return False;
- ps->data_offset += 48;
-
- if (!smb_io_unistr2("uni_grp_name", &info->uni_grp_name,
- info->hdr_grp_name.buffer, ps, depth))
- return False;
- if (!smb_io_unistr2("uni_grp_desc", &info->uni_grp_desc,
- info->hdr_grp_desc.buffer, ps, depth))
- return False;
- if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_passwd_info(const char *desc, SAM_PWD * pwd,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "net_io_sam_passwd_info");
- depth++;
-
- if (!prs_uint32("unk_0 ", ps, depth, &pwd->unk_0))
- return False;
-
- if (!smb_io_unihdr("hdr_lm_pwd", &pwd->hdr_lm_pwd, ps, depth))
- return False;
- if (!prs_uint8s(False, "buf_lm_pwd", ps, depth, pwd->buf_lm_pwd, 16))
- return False;
-
- if (!smb_io_unihdr("hdr_nt_pwd", &pwd->hdr_nt_pwd, ps, depth))
- return False;
- if (!prs_uint8s(False, "buf_nt_pwd", ps, depth, pwd->buf_nt_pwd, 16))
- return False;
-
- if (!smb_io_unihdr("", &pwd->hdr_empty_lm, ps, depth))
- return False;
- if (!smb_io_unihdr("", &pwd->hdr_empty_nt, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_account_info(const char *desc, SAM_ACCOUNT_INFO *info,
- prs_struct *ps, int depth)
-{
- BUFHDR2 hdr_priv_data;
- uint32 i;
-
- prs_debug(ps, depth, desc, "net_io_sam_account_info");
- depth++;
-
- if (!smb_io_unihdr("hdr_acct_name", &info->hdr_acct_name, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_full_name", &info->hdr_full_name, ps, depth))
- return False;
-
- if (!prs_uint32("user_rid ", ps, depth, &info->user_rid))
- return False;
- if (!prs_uint32("group_rid", ps, depth, &info->group_rid))
- return False;
-
- if (!smb_io_unihdr("hdr_home_dir ", &info->hdr_home_dir, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_dir_drive", &info->hdr_dir_drive, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_logon_script", &info->hdr_logon_script, ps,
- depth))
- return False;
-
- if (!smb_io_unihdr("hdr_acct_desc", &info->hdr_acct_desc, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_workstations", &info->hdr_workstations, ps,
- depth))
- return False;
-
- if (!smb_io_time("logon_time", &info->logon_time, ps, depth))
- return False;
- if (!smb_io_time("logoff_time", &info->logoff_time, ps, depth))
- return False;
-
- if (!prs_uint32("logon_divs ", ps, depth, &info->logon_divs))
- return False;
- if (!prs_uint32("ptr_logon_hrs", ps, depth, &info->ptr_logon_hrs))
- return False;
-
- if (!prs_uint16("bad_pwd_count", ps, depth, &info->bad_pwd_count))
- return False;
- if (!prs_uint16("logon_count", ps, depth, &info->logon_count))
- return False;
- if (!smb_io_time("pwd_last_set_time", &info->pwd_last_set_time, ps,
- depth))
- return False;
- if (!smb_io_time("acct_expiry_time", &info->acct_expiry_time, ps,
- depth))
- return False;
-
- if (!prs_uint32("acb_info", ps, depth, &info->acb_info))
- return False;
- if (!prs_uint8s(False, "nt_pwd", ps, depth, info->nt_pwd, 16))
- return False;
- if (!prs_uint8s(False, "lm_pwd", ps, depth, info->lm_pwd, 16))
- return False;
- if (!prs_uint8("lm_pwd_present", ps, depth, &info->lm_pwd_present))
- return False;
- if (!prs_uint8("nt_pwd_present", ps, depth, &info->nt_pwd_present))
- return False;
- if (!prs_uint8("pwd_expired", ps, depth, &info->pwd_expired))
- return False;
-
- if (!smb_io_unihdr("hdr_comment", &info->hdr_comment, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_parameters", &info->hdr_parameters, ps,
- depth))
- return False;
- if (!prs_uint16("country", ps, depth, &info->country))
- return False;
- if (!prs_uint16("codepage", ps, depth, &info->codepage))
- return False;
-
- if (!smb_io_bufhdr2("hdr_priv_data", &hdr_priv_data, ps, depth))
- return False;
- if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_profile", &info->hdr_profile, ps, depth))
- return False;
-
- for (i = 0; i < 3; i++)
- {
- if (!smb_io_unihdr("hdr_reserved", &info->hdr_reserved[i],
- ps, depth))
- return False;
- }
-
- for (i = 0; i < 4; i++)
- {
- if (!prs_uint32("dw_reserved", ps, depth,
- &info->dw_reserved[i]))
- return False;
- }
-
- if (!smb_io_unistr2("uni_acct_name", &info->uni_acct_name,
- info->hdr_acct_name.buffer, ps, depth))
- return False;
- prs_align(ps);
- if (!smb_io_unistr2("uni_full_name", &info->uni_full_name,
- info->hdr_full_name.buffer, ps, depth))
- return False;
- prs_align(ps);
- if (!smb_io_unistr2("uni_home_dir ", &info->uni_home_dir,
- info->hdr_home_dir.buffer, ps, depth))
- return False;
- prs_align(ps);
- if (!smb_io_unistr2("uni_dir_drive", &info->uni_dir_drive,
- info->hdr_dir_drive.buffer, ps, depth))
- return False;
- prs_align(ps);
- if (!smb_io_unistr2("uni_logon_script", &info->uni_logon_script,
- info->hdr_logon_script.buffer, ps, depth))
- return False;
- prs_align(ps);
- if (!smb_io_unistr2("uni_acct_desc", &info->uni_acct_desc,
- info->hdr_acct_desc.buffer, ps, depth))
- return False;
- prs_align(ps);
- if (!smb_io_unistr2("uni_workstations", &info->uni_workstations,
- info->hdr_workstations.buffer, ps, depth))
- return False;
- prs_align(ps);
-
- if (!prs_uint32("unknown1", ps, depth, &info->unknown1))
- return False;
- if (!prs_uint32("unknown2", ps, depth, &info->unknown2))
- return False;
-
- if (!smb_io_rpc_blob("buf_logon_hrs", &info->buf_logon_hrs, ps, depth))
- return False;
- prs_align(ps);
- if (!smb_io_unistr2("uni_comment", &info->uni_comment,
- info->hdr_comment.buffer, ps, depth))
- return False;
- prs_align(ps);
- if (!smb_io_unistr2("uni_parameters", &info->uni_parameters,
- info->hdr_parameters.buffer, ps, depth))
- return False;
- prs_align(ps);
- if (hdr_priv_data.buffer != 0)
- {
- int old_offset = 0;
- uint32 len = 0x44;
- if (!prs_uint32("pwd_len", ps, depth, &len))
- return False;
- old_offset = ps->data_offset;
- if (len > 0)
- {
- if (ps->io)
- {
- /* reading */
- if (!prs_hash1(ps, ps->data_offset, len))
- return False;
- }
- if (!net_io_sam_passwd_info("pass", &info->pass,
- ps, depth))
- return False;
-
- if (!ps->io)
- {
- /* writing */
- if (!prs_hash1(ps, old_offset, len))
- return False;
- }
- }
- if (old_offset + len > ps->buffer_size)
- return False;
- ps->data_offset = old_offset + len;
- }
- if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
- return False;
- prs_align(ps);
- if (!smb_io_unistr2("uni_profile", &info->uni_profile,
- info->hdr_profile.buffer, ps, depth))
- return False;
-
- prs_align(ps);
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * info,
- prs_struct *ps, int depth)
-{
- uint32 i;
- fstring tmp;
-
- prs_debug(ps, depth, desc, "net_io_sam_group_mem_info");
- depth++;
-
- prs_align(ps);
- if (!prs_uint32("ptr_rids ", ps, depth, &info->ptr_rids))
- return False;
- if (!prs_uint32("ptr_attribs", ps, depth, &info->ptr_attribs))
- return False;
- if (!prs_uint32("num_members", ps, depth, &info->num_members))
- return False;
-
- if (ps->data_offset + 16 > ps->buffer_size)
- return False;
- ps->data_offset += 16;
-
- if (info->ptr_rids != 0)
- {
- if (!prs_uint32("num_members2", ps, depth,
- &info->num_members2))
- return False;
-
- if (info->num_members2 != info->num_members)
- {
- /* RPC fault */
- return False;
- }
-
- if (UNMARSHALLING(ps)) {
- if (info->num_members2) {
- info->rids = TALLOC_ARRAY(ps->mem_ctx, uint32, info->num_members2);
-
- if (info->rids == NULL) {
- DEBUG(0, ("out of memory allocating %d rids\n",
- info->num_members2));
- return False;
- }
- } else {
- info->rids = NULL;
- }
- }
-
- for (i = 0; i < info->num_members2; i++)
- {
- slprintf(tmp, sizeof(tmp) - 1, "rids[%02d]", i);
- if (!prs_uint32(tmp, ps, depth, &info->rids[i]))
- return False;
- }
- }
-
- if (info->ptr_attribs != 0)
- {
- if (!prs_uint32("num_members3", ps, depth,
- &info->num_members3))
- return False;
- if (info->num_members3 != info->num_members)
- {
- /* RPC fault */
- return False;
- }
-
- if (UNMARSHALLING(ps)) {
- if (info->num_members3) {
- info->attribs = TALLOC_ARRAY(ps->mem_ctx, uint32, info->num_members3);
-
- if (info->attribs == NULL) {
- DEBUG(0, ("out of memory allocating %d attribs\n",
- info->num_members3));
- return False;
- }
- } else {
- info->attribs = NULL;
- }
- }
-
- for (i = 0; i < info->num_members3; i++)
- {
- slprintf(tmp, sizeof(tmp) - 1, "attribs[%02d]", i);
- if (!prs_uint32(tmp, ps, depth, &info->attribs[i]))
- return False;
- }
- }
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "net_io_sam_alias_info");
- depth++;
-
- if (!smb_io_unihdr("hdr_als_name", &info->hdr_als_name, ps, depth))
- return False;
- if (!prs_uint32("als_rid", ps, depth, &info->als_rid))
- return False;
- if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_als_desc", &info->hdr_als_desc, ps, depth))
- return False;
-
- if (ps->data_offset + 40 > ps->buffer_size)
- return False;
- ps->data_offset += 40;
-
- if (!smb_io_unistr2("uni_als_name", &info->uni_als_name,
- info->hdr_als_name.buffer, ps, depth))
- return False;
- if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
- return False;
-
- if (!smb_io_unistr2("uni_als_desc", &info->uni_als_desc,
- info->hdr_als_desc.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * info,
- prs_struct *ps, int depth)
-{
- uint32 i;
- fstring tmp;
-
- prs_debug(ps, depth, desc, "net_io_sam_alias_mem_info");
- depth++;
-
- prs_align(ps);
- if (!prs_uint32("num_members", ps, depth, &info->num_members))
- return False;
- if (!prs_uint32("ptr_members", ps, depth, &info->ptr_members))
- return False;
-
- if (ps->data_offset + 16 > ps->buffer_size)
- return False;
- ps->data_offset += 16;
-
- if (info->ptr_members != 0)
- {
- if (!prs_uint32("num_sids", ps, depth, &info->num_sids))
- return False;
- if (info->num_sids != info->num_members)
- {
- /* RPC fault */
- return False;
- }
-
- if (UNMARSHALLING(ps)) {
- if (info->num_sids) {
- info->ptr_sids = TALLOC_ARRAY(ps->mem_ctx, uint32, info->num_sids);
-
- if (info->ptr_sids == NULL) {
- DEBUG(0, ("out of memory allocating %d ptr_sids\n",
- info->num_sids));
- return False;
- }
- } else {
- info->ptr_sids = NULL;
- }
- }
-
- for (i = 0; i < info->num_sids; i++)
- {
- slprintf(tmp, sizeof(tmp) - 1, "ptr_sids[%02d]", i);
- if (!prs_uint32(tmp, ps, depth, &info->ptr_sids[i]))
- return False;
- }
-
- if (UNMARSHALLING(ps)) {
- if (info->num_sids) {
- info->sids = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, info->num_sids);
-
- if (info->sids == NULL) {
- DEBUG(0, ("error allocating %d sids\n",
- info->num_sids));
- return False;
- }
- } else {
- info->sids = NULL;
- }
- }
-
- for (i = 0; i < info->num_sids; i++)
- {
- if (info->ptr_sids[i] != 0)
- {
- slprintf(tmp, sizeof(tmp) - 1, "sids[%02d]",
- i);
- if (!smb_io_dom_sid2(tmp, &info->sids[i],
- ps, depth))
- return False;
- }
- }
- }
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info,
- prs_struct *ps, int depth)
-{
- unsigned int i;
- prs_debug(ps, depth, desc, "net_io_sam_policy_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!prs_uint32("max_log_size", ps, depth, &info->max_log_size))
- return False;
- if (!prs_uint64("audit_retention_period", ps, depth,
- &info->audit_retention_period))
- return False;
- if (!prs_uint32("auditing_mode", ps, depth, &info->auditing_mode))
- return False;
- if (!prs_uint32("num_events", ps, depth, &info->num_events))
- return False;
- if (!prs_uint32("ptr_events", ps, depth, &info->ptr_events))
- return False;
-
- if (!smb_io_unihdr("hdr_dom_name", &info->hdr_dom_name, ps, depth))
- return False;
-
- if (!prs_uint32("sid_ptr", ps, depth, &info->sid_ptr))
- return False;
-
- if (!prs_uint32("paged_pool_limit", ps, depth, &info->paged_pool_limit))
- return False;
- if (!prs_uint32("non_paged_pool_limit", ps, depth,
- &info->non_paged_pool_limit))
- return False;
- if (!prs_uint32("min_workset_size", ps, depth, &info->min_workset_size))
- return False;
- if (!prs_uint32("max_workset_size", ps, depth, &info->max_workset_size))
- return False;
- if (!prs_uint32("page_file_limit", ps, depth, &info->page_file_limit))
- return False;
- if (!prs_uint64("time_limit", ps, depth, &info->time_limit))
- return False;
- if (!smb_io_time("modify_time", &info->modify_time, ps, depth))
- return False;
- if (!smb_io_time("create_time", &info->create_time, ps, depth))
- return False;
- if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth))
- return False;
-
- for (i=0; i<4; i++) {
- UNIHDR dummy;
- if (!smb_io_unihdr("dummy", &dummy, ps, depth))
- return False;
- }
-
- for (i=0; i<4; i++) {
- uint32 reserved;
- if (!prs_uint32("reserved", ps, depth, &reserved))
- return False;
- }
-
- if (!prs_uint32("num_event_audit_options", ps, depth,
- &info->num_event_audit_options))
- return False;
-
- for (i=0; i<info->num_event_audit_options; i++)
- if (!prs_uint32("event_audit_option", ps, depth,
- &info->event_audit_option))
- return False;
-
- if (!smb_io_unistr2("domain_name", &info->domain_name, True, ps, depth))
- return False;
-
- if(!smb_io_dom_sid2("domain_sid", &info->domain_sid, ps, depth))
- return False;
-
- if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
-
- return False;
-
- return True;
-}
-
-#if 0
-
-/* This function is pretty broken - see bug #334 */
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_trustdoms_info(const char *desc, SAM_DELTA_TRUSTDOMS *info,
- prs_struct *ps, int depth)
-{
- int i;
-
- prs_debug(ps, depth, desc, "net_io_sam_trustdoms_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("buf_size", ps, depth, &info->buf_size))
- return False;
-
- if(!sec_io_desc("sec_desc", &info->sec_desc, ps, depth))
- return False;
-
- if(!smb_io_dom_sid2("sid", &info->sid, ps, depth))
- return False;
-
- if(!smb_io_unihdr("hdr_domain", &info->hdr_domain, ps, depth))
- return False;
-
- if(!prs_uint32("unknown0", ps, depth, &info->unknown0))
- return False;
- if(!prs_uint32("unknown1", ps, depth, &info->unknown1))
- return False;
- if(!prs_uint32("unknown2", ps, depth, &info->unknown2))
- return False;
-
- if(!prs_uint32("buf_size2", ps, depth, &info->buf_size2))
- return False;
- if(!prs_uint32("ptr", ps, depth, &info->ptr))
- return False;
-
- for (i=0; i<12; i++)
- if(!prs_uint32("unknown3", ps, depth, &info->unknown3))
- return False;
-
- if (!smb_io_unistr2("domain", &info->domain, True, ps, depth))
- return False;
-
- return True;
-}
-
-#endif
-
-#if 0
-
-/* This function doesn't work - see bug #334 */
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_secret_info(const char *desc, SAM_DELTA_SECRET *info,
- prs_struct *ps, int depth)
-{
- int i;
-
- prs_debug(ps, depth, desc, "net_io_sam_secret_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("buf_size", ps, depth, &info->buf_size))
- return False;
-
- if(!sec_io_desc("sec_desc", &info->sec_desc, ps, depth))
- return False;
-
- if (!smb_io_unistr2("secret", &info->secret, True, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("count1", ps, depth, &info->count1))
- return False;
- if(!prs_uint32("count2", ps, depth, &info->count2))
- return False;
- if(!prs_uint32("ptr", ps, depth, &info->ptr))
- return False;
-
-
- if(!smb_io_time("time1", &info->time1, ps, depth)) /* logon time */
- return False;
- if(!prs_uint32("count3", ps, depth, &info->count3))
- return False;
- if(!prs_uint32("count4", ps, depth, &info->count4))
- return False;
- if(!prs_uint32("ptr2", ps, depth, &info->ptr2))
- return False;
- if(!smb_io_time("time2", &info->time2, ps, depth)) /* logon time */
- return False;
- if(!prs_uint32("unknow1", ps, depth, &info->unknow1))
- return False;
-
-
- if(!prs_uint32("buf_size2", ps, depth, &info->buf_size2))
- return False;
- if(!prs_uint32("ptr3", ps, depth, &info->ptr3))
- return False;
- for(i=0; i<12; i++)
- if(!prs_uint32("unknow2", ps, depth, &info->unknow2))
- return False;
-
- if(!prs_uint32("chal_len", ps, depth, &info->chal_len))
- return False;
- if(!prs_uint32("reserved1", ps, depth, &info->reserved1))
- return False;
- if(!prs_uint32("chal_len2", ps, depth, &info->chal_len2))
- return False;
-
- if(!prs_uint8s (False, "chal", ps, depth, info->chal, info->chal_len2))
- return False;
-
- if(!prs_uint32("key_len", ps, depth, &info->key_len))
- return False;
- if(!prs_uint32("reserved2", ps, depth, &info->reserved2))
- return False;
- if(!prs_uint32("key_len2", ps, depth, &info->key_len2))
- return False;
-
- if(!prs_uint8s (False, "key", ps, depth, info->key, info->key_len2))
- return False;
-
-
- if(!prs_uint32("buf_size3", ps, depth, &info->buf_size3))
- return False;
-
- if(!sec_io_desc("sec_desc2", &info->sec_desc2, ps, depth))
- return False;
-
-
- return True;
-}
-
-#endif
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info,
- prs_struct *ps, int depth)
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "net_io_sam_privs_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_dom_sid2("sid", &info->sid, ps, depth))
- return False;
-
- if(!prs_uint32("priv_count", ps, depth, &info->priv_count))
- return False;
- if(!prs_uint32("priv_control", ps, depth, &info->priv_control))
- return False;
-
- if(!prs_uint32("priv_attr_ptr", ps, depth, &info->priv_attr_ptr))
- return False;
- if(!prs_uint32("priv_name_ptr", ps, depth, &info->priv_name_ptr))
- return False;
-
- if (!prs_uint32("paged_pool_limit", ps, depth, &info->paged_pool_limit))
- return False;
- if (!prs_uint32("non_paged_pool_limit", ps, depth,
- &info->non_paged_pool_limit))
- return False;
- if (!prs_uint32("min_workset_size", ps, depth, &info->min_workset_size))
- return False;
- if (!prs_uint32("max_workset_size", ps, depth, &info->max_workset_size))
- return False;
- if (!prs_uint32("page_file_limit", ps, depth, &info->page_file_limit))
- return False;
- if (!prs_uint64("time_limit", ps, depth, &info->time_limit))
- return False;
- if (!prs_uint32("system_flags", ps, depth, &info->system_flags))
- return False;
- if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth))
- return False;
-
- for (i=0; i<4; i++) {
- UNIHDR dummy;
- if (!smb_io_unihdr("dummy", &dummy, ps, depth))
- return False;
- }
-
- for (i=0; i<4; i++) {
- uint32 reserved;
- if (!prs_uint32("reserved", ps, depth, &reserved))
- return False;
- }
-
- if(!prs_uint32("attribute_count", ps, depth, &info->attribute_count))
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (info->attribute_count) {
- info->attributes = TALLOC_ARRAY(ps->mem_ctx, uint32, info->attribute_count);
- if (!info->attributes) {
- return False;
- }
- } else {
- info->attributes = NULL;
- }
- }
-
- for (i=0; i<info->attribute_count; i++)
- if(!prs_uint32("attributes", ps, depth, &info->attributes[i]))
- return False;
-
- if(!prs_uint32("privlist_count", ps, depth, &info->privlist_count))
- return False;
-
- if (UNMARSHALLING(ps)) {
- if (info->privlist_count) {
- info->hdr_privslist = TALLOC_ARRAY(ps->mem_ctx, UNIHDR, info->privlist_count);
- info->uni_privslist = TALLOC_ARRAY(ps->mem_ctx, UNISTR2, info->privlist_count);
- if (!info->hdr_privslist) {
- return False;
- }
- if (!info->uni_privslist) {
- return False;
- }
- } else {
- info->hdr_privslist = NULL;
- info->uni_privslist = NULL;
- }
- }
-
- for (i=0; i<info->privlist_count; i++)
- if(!smb_io_unihdr("hdr_privslist", &info->hdr_privslist[i], ps, depth))
- return False;
-
- for (i=0; i<info->privlist_count; i++)
- if (!smb_io_unistr2("uni_privslist", &info->uni_privslist[i], True, ps, depth))
- return False;
-
- if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool net_io_sam_delta_ctr(const char *desc,
- SAM_DELTA_CTR * delta, uint16 type,
- prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "net_io_sam_delta_ctr");
- depth++;
-
- switch (type) {
- /* Seen in sam deltas */
- case SAM_DELTA_MODIFIED_COUNT:
- if (!net_io_sam_delta_mod_count("", &delta->mod_count, ps, depth))
- return False;
- break;
-
- case SAM_DELTA_DOMAIN_INFO:
- if (!net_io_sam_domain_info("", &delta->domain_info, ps, depth))
- return False;
- break;
-
- case SAM_DELTA_GROUP_INFO:
- if (!net_io_sam_group_info("", &delta->group_info, ps, depth))
- return False;
- break;
-
- case SAM_DELTA_ACCOUNT_INFO:
- if (!net_io_sam_account_info("", &delta->account_info, ps, depth))
- return False;
- break;
-
- case SAM_DELTA_GROUP_MEM:
- if (!net_io_sam_group_mem_info("", &delta->grp_mem_info, ps, depth))
- return False;
- break;
-
- case SAM_DELTA_ALIAS_INFO:
- if (!net_io_sam_alias_info("", &delta->alias_info, ps, depth))
- return False;
- break;
-
- case SAM_DELTA_POLICY_INFO:
- if (!net_io_sam_policy_info("", &delta->policy_info, ps, depth))
- return False;
- break;
-
- case SAM_DELTA_ALIAS_MEM:
- if (!net_io_sam_alias_mem_info("", &delta->als_mem_info, ps, depth))
- return False;
- break;
-
- case SAM_DELTA_PRIVS_INFO:
- if (!net_io_sam_privs_info("", &delta->privs_info, ps, depth))
- return False;
- break;
-
- /* These guys are implemented but broken */
-
- case SAM_DELTA_TRUST_DOMS:
- case SAM_DELTA_SECRET_INFO:
- break;
-
- /* These guys are not implemented yet */
-
- case SAM_DELTA_RENAME_GROUP:
- case SAM_DELTA_RENAME_USER:
- case SAM_DELTA_RENAME_ALIAS:
- case SAM_DELTA_DELETE_GROUP:
- case SAM_DELTA_DELETE_USER:
- default:
- DEBUG(0, ("Replication error: Unknown delta type 0x%x\n", type));
- break;
- }
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool net_io_r_sam_sync(const char *desc,
- NET_R_SAM_SYNC * r_s, prs_struct *ps, int depth)
-{
- uint32 i;
-
- prs_debug(ps, depth, desc, "net_io_r_sam_sync");
- depth++;
-
- if (!smb_io_cred("srv_creds", &r_s->srv_creds, ps, depth))
- return False;
- if (!prs_uint32("sync_context", ps, depth, &r_s->sync_context))
- return False;
-
- if (!prs_uint32("ptr_deltas", ps, depth, &r_s->ptr_deltas))
- return False;
- if (r_s->ptr_deltas != 0)
- {
- if (!prs_uint32("num_deltas ", ps, depth, &r_s->num_deltas))
- return False;
- if (!prs_uint32("ptr_deltas2", ps, depth, &r_s->ptr_deltas2))
- return False;
- if (r_s->ptr_deltas2 != 0)
- {
- if (!prs_uint32("num_deltas2", ps, depth,
- &r_s->num_deltas2))
- return False;
-
- if (r_s->num_deltas2 != r_s->num_deltas)
- {
- /* RPC fault */
- return False;
- }
-
- if (UNMARSHALLING(ps)) {
- if (r_s->num_deltas2) {
- r_s->hdr_deltas = TALLOC_ARRAY(ps->mem_ctx, SAM_DELTA_HDR, r_s->num_deltas2);
- if (r_s->hdr_deltas == NULL) {
- DEBUG(0, ("error tallocating memory "
- "for %d delta headers\n",
- r_s->num_deltas2));
- return False;
- }
- } else {
- r_s->hdr_deltas = NULL;
- }
- }
-
- for (i = 0; i < r_s->num_deltas2; i++)
- {
- if (!net_io_sam_delta_hdr("",
- &r_s->hdr_deltas[i],
- ps, depth))
- return False;
- }
-
- if (UNMARSHALLING(ps)) {
- if (r_s->num_deltas2) {
- r_s->deltas = TALLOC_ARRAY(ps->mem_ctx, SAM_DELTA_CTR, r_s->num_deltas2);
- if (r_s->deltas == NULL) {
- DEBUG(0, ("error tallocating memory "
- "for %d deltas\n",
- r_s->num_deltas2));
- return False;
- }
- } else {
- r_s->deltas = NULL;
- }
- }
-
- for (i = 0; i < r_s->num_deltas2; i++)
- {
- if (!net_io_sam_delta_ctr(
- "", &r_s->deltas[i],
- r_s->hdr_deltas[i].type3,
- ps, depth)) {
- DEBUG(0, ("hmm, failed on i=%d\n", i));
- return False;
- }
- }
- }
- }
-
- prs_align(ps);
- if (!prs_ntstatus("status", ps, depth, &(r_s->status)))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-makes a NET_Q_SAM_DELTAS structure.
-********************************************************************/
-bool init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name,
- const char *cli_name, DOM_CRED *cli_creds,
- uint32 database_id, uint64 dom_mod_count)
-{
- DEBUG(5, ("init_net_q_sam_deltas\n"));
-
- init_unistr2(&q_s->uni_srv_name, srv_name, UNI_STR_TERMINATE);
- init_unistr2(&q_s->uni_cli_name, cli_name, UNI_STR_TERMINATE);
-
- memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds));
- memset(&q_s->ret_creds, 0, sizeof(q_s->ret_creds));
-
- q_s->database_id = database_id;
- q_s->dom_mod_count = dom_mod_count;
- q_s->max_size = 0xffff;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool net_io_q_sam_deltas(const char *desc, NET_Q_SAM_DELTAS *q_s, prs_struct *ps,
- int depth)
-{
- prs_debug(ps, depth, desc, "net_io_q_sam_deltas");
- depth++;
-
- if (!smb_io_unistr2("", &q_s->uni_srv_name, True, ps, depth))
- return False;
- if (!smb_io_unistr2("", &q_s->uni_cli_name, True, ps, depth))
- return False;
-
- if (!smb_io_cred("", &q_s->cli_creds, ps, depth))
- return False;
- if (!smb_io_cred("", &q_s->ret_creds, ps, depth))
- return False;
-
- if (!prs_uint32("database_id ", ps, depth, &q_s->database_id))
- return False;
- if (!prs_uint64("dom_mod_count", ps, depth, &q_s->dom_mod_count))
- return False;
- if (!prs_uint32("max_size", ps, depth, &q_s->max_size))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool net_io_r_sam_deltas(const char *desc,
- NET_R_SAM_DELTAS *r_s, prs_struct *ps, int depth)
-{
- unsigned int i;
-
- prs_debug(ps, depth, desc, "net_io_r_sam_deltas");
- depth++;
-
- if (!smb_io_cred("srv_creds", &r_s->srv_creds, ps, depth))
- return False;
- if (!prs_uint64("dom_mod_count", ps, depth, &r_s->dom_mod_count))
- return False;
-
- if (!prs_uint32("ptr_deltas", ps, depth, &r_s->ptr_deltas))
- return False;
- if (!prs_uint32("num_deltas", ps, depth, &r_s->num_deltas))
- return False;
- if (!prs_uint32("ptr_deltas2", ps, depth, &r_s->num_deltas2))
- return False;
-
- if (r_s->num_deltas2 != 0)
- {
- if (!prs_uint32("num_deltas2 ", ps, depth, &r_s->num_deltas2))
- return False;
-
- if (r_s->ptr_deltas != 0)
- {
- if (UNMARSHALLING(ps)) {
- if (r_s->num_deltas) {
- r_s->hdr_deltas = TALLOC_ARRAY(ps->mem_ctx, SAM_DELTA_HDR, r_s->num_deltas);
- if (r_s->hdr_deltas == NULL) {
- DEBUG(0, ("error tallocating memory "
- "for %d delta headers\n",
- r_s->num_deltas));
- return False;
- }
- } else {
- r_s->hdr_deltas = NULL;
- }
- }
-
- for (i = 0; i < r_s->num_deltas; i++)
- {
- net_io_sam_delta_hdr("", &r_s->hdr_deltas[i],
- ps, depth);
- }
-
- if (UNMARSHALLING(ps)) {
- if (r_s->num_deltas) {
- r_s->deltas = TALLOC_ARRAY(ps->mem_ctx, SAM_DELTA_CTR, r_s->num_deltas);
- if (r_s->deltas == NULL) {
- DEBUG(0, ("error tallocating memory "
- "for %d deltas\n",
- r_s->num_deltas));
- return False;
- }
- } else {
- r_s->deltas = NULL;
- }
- }
-
- for (i = 0; i < r_s->num_deltas; i++)
- {
- if (!net_io_sam_delta_ctr(
- "",
- &r_s->deltas[i],
- r_s->hdr_deltas[i].type2,
- ps, depth))
-
- return False;
- }
- }
- }
-
- prs_align(ps);
- if (!prs_ntstatus("status", ps, depth, &r_s->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a NET_Q_DSR_GETDCNAME structure.
-********************************************************************/
-
-void init_net_q_dsr_getdcname(NET_Q_DSR_GETDCNAME *r_t, const char *server_unc,
- const char *domain_name,
- struct GUID *domain_guid,
- struct GUID *site_guid,
- uint32_t flags)
-{
- DEBUG(5, ("init_net_q_dsr_getdcname\n"));
-
- r_t->ptr_server_unc = (server_unc != NULL);
- init_unistr2(&r_t->uni_server_unc, server_unc, UNI_STR_TERMINATE);
-
- r_t->ptr_domain_name = (domain_name != NULL);
- init_unistr2(&r_t->uni_domain_name, domain_name, UNI_STR_TERMINATE);
-
- r_t->ptr_domain_guid = (domain_guid != NULL);
- r_t->domain_guid = domain_guid;
-
- r_t->ptr_site_guid = (site_guid != NULL);
- r_t->site_guid = site_guid;
-
- r_t->flags = flags;
-}
-
-/*******************************************************************
- Inits a NET_Q_DSR_GETDCNAMEEX structure.
-********************************************************************/
-
-void init_net_q_dsr_getdcnameex(NET_Q_DSR_GETDCNAMEEX *r_t, const char *server_unc,
- const char *domain_name,
- struct GUID *domain_guid,
- const char *site_name,
- uint32_t flags)
-{
- DEBUG(5, ("init_net_q_dsr_getdcnameex\n"));
-
- r_t->ptr_server_unc = (server_unc != NULL);
- init_unistr2(&r_t->uni_server_unc, server_unc, UNI_STR_TERMINATE);
-
- r_t->ptr_domain_name = (domain_name != NULL);
- init_unistr2(&r_t->uni_domain_name, domain_name, UNI_STR_TERMINATE);
-
- r_t->ptr_domain_guid = (domain_guid != NULL);
- r_t->domain_guid = domain_guid;
-
- r_t->ptr_site_name = (site_name != NULL);
- init_unistr2(&r_t->uni_site_name, site_name, UNI_STR_TERMINATE);
-
- r_t->flags = flags;
-}
-
-/*******************************************************************
- Inits a NET_Q_DSR_GETDCNAMEEX2 structure.
-********************************************************************/
-
-void init_net_q_dsr_getdcnameex2(NET_Q_DSR_GETDCNAMEEX2 *r_t, const char *server_unc,
- const char *domain_name,
- const char *client_account,
- uint32 mask,
- struct GUID *domain_guid,
- const char *site_name,
- uint32_t flags)
-{
- DEBUG(5, ("init_net_q_dsr_getdcnameex2\n"));
-
- r_t->ptr_server_unc = (server_unc != NULL);
- init_unistr2(&r_t->uni_server_unc, server_unc, UNI_STR_TERMINATE);
-
- r_t->ptr_client_account = (client_account != NULL);
- init_unistr2(&r_t->uni_client_account, client_account, UNI_STR_TERMINATE);
-
- r_t->mask = mask;
-
- r_t->ptr_domain_name = (domain_name != NULL);
- init_unistr2(&r_t->uni_domain_name, domain_name, UNI_STR_TERMINATE);
-
- r_t->ptr_domain_guid = (domain_guid != NULL);
- r_t->domain_guid = domain_guid;
-
- r_t->ptr_site_name = (site_name != NULL);
- init_unistr2(&r_t->uni_site_name, site_name, UNI_STR_TERMINATE);
-
- r_t->flags = flags;
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_DSR_GETDCNAME structure.
-********************************************************************/
-
-bool net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t,
- prs_struct *ps, int depth)
-{
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_dsr_getdcname");
- depth++;
-
- if (!prs_uint32("ptr_server_unc", ps, depth, &r_t->ptr_server_unc))
- return False;
-
- if (!smb_io_unistr2("server_unc", &r_t->uni_server_unc,
- r_t->ptr_server_unc, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_domain_name", ps, depth, &r_t->ptr_domain_name))
- return False;
-
- if (!smb_io_unistr2("domain_name", &r_t->uni_domain_name,
- r_t->ptr_domain_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_domain_guid", ps, depth, &r_t->ptr_domain_guid))
- return False;
-
- if (UNMARSHALLING(ps) && (r_t->ptr_domain_guid)) {
- r_t->domain_guid = PRS_ALLOC_MEM(ps, struct GUID, 1);
- if (r_t->domain_guid == NULL)
- return False;
- }
-
- if ((r_t->ptr_domain_guid) &&
- (!smb_io_uuid("domain_guid", r_t->domain_guid, ps, depth)))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_site_guid", ps, depth, &r_t->ptr_site_guid))
- return False;
-
- if (UNMARSHALLING(ps) && (r_t->ptr_site_guid)) {
- r_t->site_guid = PRS_ALLOC_MEM(ps, struct GUID, 1);
- if (r_t->site_guid == NULL)
- return False;
- }
-
- if ((r_t->ptr_site_guid) &&
- (!smb_io_uuid("site_guid", r_t->site_guid, ps, depth)))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("flags", ps, depth, &r_t->flags))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_DSR_GETDCNAMEEX structure.
-********************************************************************/
-
-bool net_io_q_dsr_getdcnameex(const char *desc, NET_Q_DSR_GETDCNAMEEX *r_t,
- prs_struct *ps, int depth)
-{
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_dsr_getdcnameex");
- depth++;
-
- if (!prs_uint32("ptr_server_unc", ps, depth, &r_t->ptr_server_unc))
- return False;
-
- if (!smb_io_unistr2("server_unc", &r_t->uni_server_unc,
- r_t->ptr_server_unc, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_domain_name", ps, depth, &r_t->ptr_domain_name))
- return False;
-
- if (!smb_io_unistr2("domain_name", &r_t->uni_domain_name,
- r_t->ptr_domain_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_domain_guid", ps, depth, &r_t->ptr_domain_guid))
- return False;
-
- if (UNMARSHALLING(ps) && (r_t->ptr_domain_guid)) {
- r_t->domain_guid = PRS_ALLOC_MEM(ps, struct GUID, 1);
- if (r_t->domain_guid == NULL)
- return False;
- }
-
- if ((r_t->ptr_domain_guid) &&
- (!smb_io_uuid("domain_guid", r_t->domain_guid, ps, depth)))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_site_name", ps, depth, &r_t->ptr_site_name))
- return False;
-
- if (!smb_io_unistr2("site_name", &r_t->uni_site_name,
- r_t->ptr_site_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("flags", ps, depth, &r_t->flags))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_DSR_GETDCNAMEEX2 structure.
-********************************************************************/
-
-bool net_io_q_dsr_getdcnameex2(const char *desc, NET_Q_DSR_GETDCNAMEEX2 *r_t,
- prs_struct *ps, int depth)
-{
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_dsr_getdcnameex2");
- depth++;
-
- if (!prs_uint32("ptr_server_unc", ps, depth, &r_t->ptr_server_unc))
- return False;
-
- if (!smb_io_unistr2("server_unc", &r_t->uni_server_unc,
- r_t->ptr_server_unc, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_client_account", ps, depth, &r_t->ptr_client_account))
- return False;
-
- if (!smb_io_unistr2("client_account", &r_t->uni_client_account,
- r_t->ptr_client_account, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("mask", ps, depth, &r_t->mask))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_domain_name", ps, depth, &r_t->ptr_domain_name))
- return False;
-
- if (!smb_io_unistr2("domain_name", &r_t->uni_domain_name,
- r_t->ptr_domain_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_domain_guid", ps, depth, &r_t->ptr_domain_guid))
- return False;
-
- if (UNMARSHALLING(ps) && (r_t->ptr_domain_guid)) {
- r_t->domain_guid = PRS_ALLOC_MEM(ps, struct GUID, 1);
- if (r_t->domain_guid == NULL)
- return False;
- }
-
- if ((r_t->ptr_domain_guid) &&
- (!smb_io_uuid("domain_guid", r_t->domain_guid, ps, depth)))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_site_name", ps, depth, &r_t->ptr_site_name))
- return False;
-
- if (!smb_io_unistr2("site_name", &r_t->uni_site_name,
- r_t->ptr_site_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("flags", ps, depth, &r_t->flags))
- return False;
-
- return True;
-}
-
-
-
-/*******************************************************************
- Inits a NET_R_DSR_GETDCNAME structure.
-********************************************************************/
-void init_net_r_dsr_getdcname(NET_R_DSR_GETDCNAME *r_t, const char *dc_unc,
- const char *dc_address, int32 dc_address_type,
- struct GUID domain_guid, const char *domain_name,
- const char *forest_name, uint32 dc_flags,
- const char *dc_site_name,
- const char *client_site_name)
-{
- DEBUG(5, ("init_net_q_dsr_getdcname\n"));
-
- r_t->ptr_dc_unc = (dc_unc != NULL);
- init_unistr2(&r_t->uni_dc_unc, dc_unc, UNI_STR_TERMINATE);
-
- r_t->ptr_dc_address = (dc_address != NULL);
- init_unistr2(&r_t->uni_dc_address, dc_address, UNI_STR_TERMINATE);
-
- r_t->dc_address_type = dc_address_type;
- r_t->domain_guid = domain_guid;
-
- r_t->ptr_domain_name = (domain_name != NULL);
- init_unistr2(&r_t->uni_domain_name, domain_name, UNI_STR_TERMINATE);
-
- r_t->ptr_forest_name = (forest_name != NULL);
- init_unistr2(&r_t->uni_forest_name, forest_name, UNI_STR_TERMINATE);
-
- r_t->dc_flags = dc_flags;
-
- r_t->ptr_dc_site_name = (dc_site_name != NULL);
- init_unistr2(&r_t->uni_dc_site_name, dc_site_name, UNI_STR_TERMINATE);
-
- r_t->ptr_client_site_name = (client_site_name != NULL);
- init_unistr2(&r_t->uni_client_site_name, client_site_name,
- UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes an NET_R_DSR_GETDCNAME structure.
-********************************************************************/
-
-bool net_io_r_dsr_getdcname(const char *desc, NET_R_DSR_GETDCNAME *r_t,
- prs_struct *ps, int depth)
-{
- uint32 info_ptr = 1;
-
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_dsr_getdcname");
- depth++;
-
- /* The reply contains *just* an info struct, this is the ptr to it */
- if (!prs_uint32("info_ptr", ps, depth, &info_ptr))
- return False;
-
- if (info_ptr == 0)
- return False;
-
- if (!prs_uint32("ptr_dc_unc", ps, depth, &r_t->ptr_dc_unc))
- return False;
-
- if (!prs_uint32("ptr_dc_address", ps, depth, &r_t->ptr_dc_address))
- return False;
-
- if (!prs_int32("dc_address_type", ps, depth, &r_t->dc_address_type))
- return False;
-
- if (!smb_io_uuid("domain_guid", &r_t->domain_guid, ps, depth))
- return False;
-
- if (!prs_uint32("ptr_domain_name", ps, depth, &r_t->ptr_domain_name))
- return False;
-
- if (!prs_uint32("ptr_forest_name", ps, depth, &r_t->ptr_forest_name))
- return False;
-
- if (!prs_uint32("dc_flags", ps, depth, &r_t->dc_flags))
- return False;
-
- if (!prs_uint32("ptr_dc_site_name", ps, depth, &r_t->ptr_dc_site_name))
- return False;
-
- if (!prs_uint32("ptr_client_site_name", ps, depth,
- &r_t->ptr_client_site_name))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!smb_io_unistr2("dc_unc", &r_t->uni_dc_unc,
- r_t->ptr_dc_unc, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!smb_io_unistr2("dc_address", &r_t->uni_dc_address,
- r_t->ptr_dc_address, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!smb_io_unistr2("domain_name", &r_t->uni_domain_name,
- r_t->ptr_domain_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!smb_io_unistr2("forest_name", &r_t->uni_forest_name,
- r_t->ptr_forest_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!smb_io_unistr2("dc_site_name", &r_t->uni_dc_site_name,
- r_t->ptr_dc_site_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!smb_io_unistr2("client_site_name", &r_t->uni_client_site_name,
- r_t->ptr_client_site_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_werror("result", ps, depth, &r_t->result))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits a NET_Q_DSR_GETSITENAME structure.
-********************************************************************/
-
-void init_net_q_dsr_getsitename(NET_Q_DSR_GETSITENAME *r_t, const char *computer_name)
-{
- DEBUG(5, ("init_net_q_dsr_getsitename\n"));
-
- r_t->ptr_computer_name = (computer_name != NULL);
- init_unistr2(&r_t->uni_computer_name, computer_name, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_DSR_GETSITENAME structure.
-********************************************************************/
-
-bool net_io_q_dsr_getsitename(const char *desc, NET_Q_DSR_GETSITENAME *r_t,
- prs_struct *ps, int depth)
-{
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_q_dsr_getsitename");
- depth++;
-
- if (!prs_uint32("ptr_computer_name", ps, depth, &r_t->ptr_computer_name))
- return False;
-
- if (!smb_io_unistr2("computer_name", &r_t->uni_computer_name,
- r_t->ptr_computer_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Reads or writes an NET_R_DSR_GETSITENAME structure.
-********************************************************************/
-
-bool net_io_r_dsr_getsitename(const char *desc, NET_R_DSR_GETSITENAME *r_t,
- prs_struct *ps, int depth)
-{
- if (r_t == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "net_io_r_dsr_getsitename");
- depth++;
-
- if (!prs_uint32("ptr_site_name", ps, depth, &r_t->ptr_site_name))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!smb_io_unistr2("site_name", &r_t->uni_site_name,
- r_t->ptr_site_name, ps, depth))
- return False;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_werror("result", ps, depth, &r_t->result))
- 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_samr.c b/source3/rpc_parse/parse_samr.c
deleted file mode 100644
index 614a80dd6f..0000000000
--- a/source3/rpc_parse/parse_samr.c
+++ /dev/null
@@ -1,8057 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * RPC Pipe client / server routines
- * Copyright (C) Andrew Tridgell 1992-2000,
- * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
- * Copyright (C) Paul Ashton 1997-2000,
- * Copyright (C) Elrond 2000,
- * Copyright (C) Jeremy Allison 2001,
- * Copyright (C) Jean François Micouleau 1998-2001,
- * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 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
-
-/*******************************************************************
-inits a SAMR_Q_CLOSE_HND structure.
-********************************************************************/
-
-void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND *hnd)
-{
- DEBUG(5, ("init_samr_q_close_hnd\n"));
-
- q_c->pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_close_hnd");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- return smb_io_pol_hnd("pol", &q_u->pol, ps, depth);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_close_hnd(const char *desc, SAMR_R_CLOSE_HND * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_close_hnd");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_LOOKUP_DOMAIN structure.
-********************************************************************/
-
-void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u,
- POLICY_HND *pol, char *dom_name)
-{
- DEBUG(5, ("init_samr_q_lookup_domain\n"));
-
- q_u->connect_pol = *pol;
-
- init_unistr2(&q_u->uni_domain, dom_name, UNI_FLAGS_NONE);
- init_uni_hdr(&q_u->hdr_domain, &q_u->uni_domain);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool samr_io_q_lookup_domain(const char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_lookup_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth))
- return False;
-
- if(!smb_io_unihdr("hdr_domain", &q_u->hdr_domain, ps, depth))
- return False;
-
- if(!smb_io_unistr2("uni_domain", &q_u->uni_domain, q_u->hdr_domain.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_LOOKUP_DOMAIN structure.
-********************************************************************/
-
-void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u,
- DOM_SID *dom_sid, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_lookup_domain\n"));
-
- r_u->status = status;
- r_u->ptr_sid = 0;
- if (NT_STATUS_IS_OK(status)) {
- r_u->ptr_sid = 1;
- init_dom_sid2(&r_u->dom_sid, dom_sid);
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_lookup_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr", ps, depth, &r_u->ptr_sid))
- return False;
-
- if (r_u->ptr_sid != 0) {
- if(!smb_io_dom_sid2("sid", &r_u->dom_sid, ps, depth))
- return False;
- if(!prs_align(ps))
- return False;
- }
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_remove_sid_foreign_domain(SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u, POLICY_HND *dom_pol, DOM_SID *sid)
-{
- DEBUG(5, ("samr_init_samr_q_remove_sid_foreign_domain\n"));
-
- q_u->dom_pol = *dom_pol;
- init_dom_sid2(&q_u->sid, sid);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_remove_sid_foreign_domain(const char *desc, SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_remove_sid_foreign_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth))
- return False;
-
- if(!smb_io_dom_sid2("sid", &q_u->sid, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_remove_sid_foreign_domain(const char *desc, SAMR_R_REMOVE_SID_FOREIGN_DOMAIN * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_remove_sid_foreign_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u,
- POLICY_HND *pol, uint32 flags,
- const DOM_SID *sid)
-{
- DEBUG(5, ("samr_init_samr_q_open_domain\n"));
-
- q_u->pol = *pol;
- q_u->flags = flags;
- init_dom_sid2(&q_u->dom_sid, sid);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_open_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
- return False;
-
- if(!prs_uint32("flags", ps, depth, &q_u->flags))
- return False;
-
- if(!smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_open_domain(const char *desc, SAMR_R_OPEN_DOMAIN * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_open_domain");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &r_u->domain_pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u,
- POLICY_HND *user_pol)
-{
- DEBUG(5, ("samr_init_samr_q_get_usrdom_pwinfo\n"));
-
- q_u->user_pol = *user_pol;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_get_usrdom_pwinfo(const char *desc, SAMR_Q_GET_USRDOM_PWINFO * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_get_usrdom_pwinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- return smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth);
-}
-
-/*******************************************************************
- Init.
-********************************************************************/
-
-void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n"));
-
- r_u->min_pwd_length = 0x0000;
-
- /*
- * used to be
- * r_u->unknown_1 = 0x0015;
- * but for trusts.
- */
- r_u->unknown_1 = 0x01D1;
- r_u->unknown_1 = 0x0015;
-
- r_u->password_properties = 0x00000000;
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_get_usrdom_pwinfo(const char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_get_usrdom_pwinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length))
- return False;
- if(!prs_uint16("unknown_1", ps, depth, &r_u->unknown_1))
- return False;
- if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties))
- return False;
-
- if(!prs_ntstatus("status ", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_set_sec_obj(const char *desc, SAMR_Q_SET_SEC_OBJ * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_set_sec_obj");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
- return False;
-
- if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
- return False;
-
- if(!sec_io_desc_buf("sec_desc", &q_u->buf, ps, depth))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ * q_u,
- POLICY_HND *user_pol, uint32 sec_info)
-{
- DEBUG(5, ("samr_init_samr_q_query_sec_obj\n"));
-
- q_u->user_pol = *user_pol;
- q_u->sec_info = sec_info;
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_query_sec_obj(const char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_sec_obj");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth))
- return False;
-
- if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_query_domain_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u,
- POLICY_HND *domain_pol, uint16 switch_value)
-{
- DEBUG(5, ("samr_init_samr_q_query_domain_info\n"));
-
- q_u->domain_pol = *domain_pol;
- q_u->switch_value = switch_value;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_query_domain_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_domain_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
- return False;
-
- if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist,
- uint32 password_properties, NTTIME nt_expire, NTTIME nt_min_age)
-{
- u_1->min_length_password = min_pass_len;
- u_1->password_history = pass_hist;
-
- if (lp_check_password_script() && *lp_check_password_script()) {
- password_properties |= DOMAIN_PASSWORD_COMPLEX;
- }
- u_1->password_properties = password_properties;
-
- /* password never expire */
- u_1->expire = nt_expire;
-
- /* can change the password now */
- u_1->min_passwordage = nt_min_age;
-
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1,
- prs_struct *ps, int depth)
-{
- if (u_1 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info1");
- depth++;
-
- if(!prs_uint16("min_length_password", ps, depth, &u_1->min_length_password))
- return False;
- if(!prs_uint16("password_history", ps, depth, &u_1->password_history))
- return False;
- if(!prs_uint32("password_properties", ps, depth, &u_1->password_properties))
- return False;
- if(!smb_io_time("expire", &u_1->expire, ps, depth))
- return False;
- if(!smb_io_time("min_passwordage", &u_1->min_passwordage, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info2(SAM_UNK_INFO_2 * u_2,
- const char *comment, const char *domain, const char *server,
- uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias, NTTIME nt_logout, uint32 server_role)
-{
- u_2->logout = nt_logout;
-
- u_2->seq_num = seq_num;
-
-
- u_2->unknown_4 = 0x00000001;
- u_2->server_role = server_role;
- u_2->unknown_6 = 0x00000001;
- u_2->num_domain_usrs = num_users;
- u_2->num_domain_grps = num_groups;
- u_2->num_local_grps = num_alias;
-
- init_unistr2(&u_2->uni_comment, comment, UNI_FLAGS_NONE);
- init_uni_hdr(&u_2->hdr_comment, &u_2->uni_comment);
- init_unistr2(&u_2->uni_domain, domain, UNI_FLAGS_NONE);
- init_uni_hdr(&u_2->hdr_domain, &u_2->uni_domain);
- init_unistr2(&u_2->uni_server, server, UNI_FLAGS_NONE);
- init_uni_hdr(&u_2->hdr_server, &u_2->uni_server);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2,
- prs_struct *ps, int depth)
-{
- if (u_2 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info2");
- depth++;
-
- if(!smb_io_time("logout", &u_2->logout, ps, depth))
- return False;
- if(!smb_io_unihdr("hdr_comment", &u_2->hdr_comment, ps, depth))
- return False;
- if(!smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth))
- return False;
- if(!smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth))
- return False;
-
- /* put all the data in here, at the moment, including what the above
- pointer is referring to
- */
-
- if(!prs_uint64("seq_num ", ps, depth, &u_2->seq_num))
- return False;
-
- if(!prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4)) /* 0x0000 0001 */
- return False;
- if(!prs_uint32("server_role ", ps, depth, &u_2->server_role))
- return False;
- if(!prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6)) /* 0x0000 0001 */
- return False;
- if(!prs_uint32("num_domain_usrs ", ps, depth, &u_2->num_domain_usrs))
- return False;
- if(!prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps))
- return False;
- if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps))
- return False;
-
- if(!smb_io_unistr2("uni_comment", &u_2->uni_comment, u_2->hdr_comment.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout)
-{
- u_3->logout = nt_logout;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3,
- prs_struct *ps, int depth)
-{
- if (u_3 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info3");
- depth++;
-
- if(!smb_io_time("logout", &u_3->logout, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info4(SAM_UNK_INFO_4 * u_4,const char *comment)
-{
- init_unistr2(&u_4->uni_comment, comment, UNI_FLAGS_NONE);
- init_uni_hdr(&u_4->hdr_comment, &u_4->uni_comment);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4,
- prs_struct *ps, int depth)
-{
- if (u_4 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info4");
- depth++;
-
- if(!smb_io_unihdr("hdr_comment", &u_4->hdr_comment, ps, depth))
- return False;
-
- if(!smb_io_unistr2("uni_comment", &u_4->uni_comment, u_4->hdr_comment.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain)
-{
- init_unistr2(&u_5->uni_domain, domain, UNI_FLAGS_NONE);
- init_uni_hdr(&u_5->hdr_domain, &u_5->uni_domain);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5,
- prs_struct *ps, int depth)
-{
- if (u_5 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info5");
- depth++;
-
- if(!smb_io_unihdr("hdr_domain", &u_5->hdr_domain, ps, depth))
- return False;
-
- if(!smb_io_unistr2("uni_domain", &u_5->uni_domain, u_5->hdr_domain.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info6(SAM_UNK_INFO_6 * u_6, const char *server)
-{
- init_unistr2(&u_6->uni_server, server, UNI_FLAGS_NONE);
- init_uni_hdr(&u_6->hdr_server, &u_6->uni_server);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6,
- prs_struct *ps, int depth)
-{
- if (u_6 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info6");
- depth++;
-
- if(!smb_io_unihdr("hdr_server", &u_6->hdr_server, ps, depth))
- return False;
-
- if(!smb_io_unistr2("uni_server", &u_6->uni_server, u_6->hdr_server.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role)
-{
- u_7->server_role = server_role;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7,
- prs_struct *ps, int depth)
-{
- if (u_7 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info7");
- depth++;
-
- if(!prs_uint16("server_role", ps, depth, &u_7->server_role))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num)
-{
- unix_to_nt_time(&u_8->domain_create_time, 0);
- u_8->seq_num = seq_num;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8,
- prs_struct *ps, int depth)
-{
- if (u_8 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info8");
- depth++;
-
- if (!prs_uint64("seq_num", ps, depth, &u_8->seq_num))
- return False;
-
- if(!smb_io_time("domain_create_time", &u_8->domain_create_time, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info9(SAM_UNK_INFO_9 * u_9, uint32 unknown)
-{
- u_9->unknown = unknown;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info9(const char *desc, SAM_UNK_INFO_9 * u_9,
- prs_struct *ps, int depth)
-{
- if (u_9 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info9");
- depth++;
-
- if (!prs_uint32("unknown", ps, depth, &u_9->unknown))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout)
-{
- u_12->duration = nt_lock_duration;
- u_12->reset_count = nt_reset_time;
-
- u_12->bad_attempt_lockout = lockout;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12,
- prs_struct *ps, int depth)
-{
- if (u_12 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info12");
- depth++;
-
- if(!smb_io_time("duration", &u_12->duration, ps, depth))
- return False;
- if(!smb_io_time("reset_count", &u_12->reset_count, ps, depth))
- return False;
- if(!prs_uint16("bad_attempt_lockout", ps, depth, &u_12->bad_attempt_lockout))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a structure.
-********************************************************************/
-
-void init_unk_info13(SAM_UNK_INFO_13 * u_13, uint32 seq_num)
-{
- unix_to_nt_time(&u_13->domain_create_time, 0);
- u_13->seq_num = seq_num;
- u_13->unknown1 = 0;
- u_13->unknown2 = 0;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13,
- prs_struct *ps, int depth)
-{
- if (u_13 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_unk_info13");
- depth++;
-
- if (!prs_uint64("seq_num", ps, depth, &u_13->seq_num))
- return False;
-
- if(!smb_io_time("domain_create_time", &u_13->domain_create_time, ps, depth))
- return False;
-
- if (!prs_uint32("unknown1", ps, depth, &u_13->unknown1))
- return False;
- if (!prs_uint32("unknown2", ps, depth, &u_13->unknown2))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_DOMAIN_INFO structure.
-********************************************************************/
-
-void init_samr_r_query_domain_info(SAMR_R_QUERY_DOMAIN_INFO * r_u,
- uint16 switch_value, SAM_UNK_CTR * ctr,
- NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_query_domain_info\n"));
-
- r_u->ptr_0 = 0;
- r_u->switch_value = 0;
- r_u->status = status; /* return status */
-
- if (NT_STATUS_IS_OK(status)) {
- r_u->switch_value = switch_value;
- r_u->ptr_0 = 1;
- r_u->ctr = ctr;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_query_domain_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_query_domain_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
- return False;
-
- if (r_u->ptr_0 != 0 && r_u->ctr != NULL) {
- if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value))
- return False;
- if(!prs_align(ps))
- return False;
-
- switch (r_u->switch_value) {
- case 0x0d:
- if(!sam_io_unk_info13("unk_inf13", &r_u->ctr->info.inf13, ps, depth))
- return False;
- break;
- case 0x0c:
- if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth))
- return False;
- break;
- case 0x09:
- if(!sam_io_unk_info9("unk_inf9",&r_u->ctr->info.inf9, ps,depth))
- return False;
- break;
- case 0x08:
- if(!sam_io_unk_info8("unk_inf8",&r_u->ctr->info.inf8, ps,depth))
- return False;
- break;
- case 0x07:
- if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth))
- return False;
- break;
- case 0x06:
- if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
- return False;
- break;
- case 0x05:
- if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
- return False;
- break;
- case 0x04:
- if(!sam_io_unk_info4("unk_inf4",&r_u->ctr->info.inf4, ps,depth))
- return False;
- break;
- case 0x03:
- if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
- return False;
- break;
- case 0x02:
- if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth))
- return False;
- break;
- case 0x01:
- if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth))
- return False;
- break;
- default:
- DEBUG(0, ("samr_io_r_query_domain_info: unknown switch level 0x%x\n",
- r_u->switch_value));
- r_u->status = NT_STATUS_INVALID_INFO_CLASS;
- return False;
- }
- }
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_set_sec_obj(SAMR_Q_SET_SEC_OBJ * q_u,
- POLICY_HND *pol, uint32 sec_info, SEC_DESC_BUF *buf)
-{
- DEBUG(5, ("samr_init_samr_q_set_sec_obj\n"));
-
- q_u->pol = *pol;
- q_u->sec_info = sec_info;
- q_u->buf = buf;
-}
-
-
-/*******************************************************************
-reads or writes a SAMR_R_SET_SEC_OBJ structure.
-********************************************************************/
-
-bool samr_io_r_set_sec_obj(const char *desc, SAMR_R_SET_SEC_OBJ * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_set_sec_obj");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a SAMR_R_QUERY_SEC_OBJ structure.
-********************************************************************/
-
-bool samr_io_r_query_sec_obj(const char *desc, SAMR_R_QUERY_SEC_OBJ * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_query_sec_obj");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
- return False;
- if (r_u->ptr != 0) {
- if(!sec_io_desc_buf("sec", &r_u->buf, ps, depth))
- return False;
- }
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a SAM_STR1 structure.
-********************************************************************/
-
-static bool sam_io_sam_str1(const char *desc, SAM_STR1 * sam, uint32 acct_buf,
- uint32 name_buf, uint32 desc_buf,
- prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_str1");
- depth++;
-
- if(!prs_align(ps))
- return False;
- if (!smb_io_unistr2("name", &sam->uni_acct_name, acct_buf, ps, depth))
- return False;
-
- if (!smb_io_unistr2("desc", &sam->uni_acct_desc, desc_buf, ps, depth))
- return False;
-
- if (!smb_io_unistr2("full", &sam->uni_full_name, name_buf, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_ENTRY1 structure.
-********************************************************************/
-
-static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx,
- UNISTR2 *sam_name, UNISTR2 *sam_full,
- UNISTR2 *sam_desc, uint32 rid_user,
- uint32 acb_info)
-{
- DEBUG(5, ("init_sam_entry1\n"));
-
- ZERO_STRUCTP(sam);
-
- sam->user_idx = user_idx;
- sam->rid_user = rid_user;
- sam->acb_info = acb_info;
-
- init_uni_hdr(&sam->hdr_acct_name, sam_name);
- init_uni_hdr(&sam->hdr_user_name, sam_full);
- init_uni_hdr(&sam->hdr_user_desc, sam_desc);
-}
-
-/*******************************************************************
-reads or writes a SAM_ENTRY1 structure.
-********************************************************************/
-
-static bool sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam,
- prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_entry1");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx))
- return False;
-
- if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user))
- return False;
- if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info))
- return False;
-
- if (!smb_io_unihdr("hdr_acct_name", &sam->hdr_acct_name, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_user_desc", &sam->hdr_user_desc, ps, depth))
- return False;
- if (!smb_io_unihdr("hdr_user_name", &sam->hdr_user_name, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a SAM_STR2 structure.
-********************************************************************/
-
-static bool sam_io_sam_str2(const char *desc, SAM_STR2 * sam, uint32 acct_buf,
- uint32 desc_buf, prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_str2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_unistr2("uni_srv_name", &sam->uni_srv_name, acct_buf, ps, depth)) /* account name unicode string */
- return False;
- if(!smb_io_unistr2("uni_srv_desc", &sam->uni_srv_desc, desc_buf, ps, depth)) /* account desc unicode string */
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_ENTRY2 structure.
-********************************************************************/
-static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx,
- UNISTR2 *sam_name, UNISTR2 *sam_desc,
- uint32 rid_user, uint32 acb_info)
-{
- DEBUG(5, ("init_sam_entry2\n"));
-
- sam->user_idx = user_idx;
- sam->rid_user = rid_user;
- sam->acb_info = acb_info;
-
- init_uni_hdr(&sam->hdr_srv_name, sam_name);
- init_uni_hdr(&sam->hdr_srv_desc, sam_desc);
-}
-
-/*******************************************************************
-reads or writes a SAM_ENTRY2 structure.
-********************************************************************/
-
-static bool sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam,
- prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_entry2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx))
- return False;
-
- if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user))
- return False;
- if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info))
- return False;
-
- if(!smb_io_unihdr("unihdr", &sam->hdr_srv_name, ps, depth)) /* account name unicode string header */
- return False;
- if(!smb_io_unihdr("unihdr", &sam->hdr_srv_desc, ps, depth)) /* account name unicode string header */
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a SAM_STR3 structure.
-********************************************************************/
-
-static bool sam_io_sam_str3(const char *desc, SAM_STR3 * sam, uint32 acct_buf,
- uint32 desc_buf, prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_str3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_unistr2("uni_grp_name", &sam->uni_grp_name, acct_buf, ps, depth)) /* account name unicode string */
- return False;
- if(!smb_io_unistr2("uni_grp_desc", &sam->uni_grp_desc, desc_buf, ps, depth)) /* account desc unicode string */
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_ENTRY3 structure.
-********************************************************************/
-
-static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx,
- UNISTR2 *grp_name, UNISTR2 *grp_desc,
- uint32 rid_grp)
-{
- DEBUG(5, ("init_sam_entry3\n"));
-
- sam->grp_idx = grp_idx;
- sam->rid_grp = rid_grp;
- sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */
-
- init_uni_hdr(&sam->hdr_grp_name, grp_name);
- init_uni_hdr(&sam->hdr_grp_desc, grp_desc);
-}
-
-/*******************************************************************
-reads or writes a SAM_ENTRY3 structure.
-********************************************************************/
-
-static bool sam_io_sam_entry3(const char *desc, SAM_ENTRY3 * sam,
- prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_entry3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx))
- return False;
-
- if(!prs_uint32("rid_grp", ps, depth, &sam->rid_grp))
- return False;
- if(!prs_uint32("attr ", ps, depth, &sam->attr))
- return False;
-
- if(!smb_io_unihdr("unihdr", &sam->hdr_grp_name, ps, depth)) /* account name unicode string header */
- return False;
- if(!smb_io_unihdr("unihdr", &sam->hdr_grp_desc, ps, depth)) /* account name unicode string header */
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_ENTRY4 structure.
-********************************************************************/
-
-static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx,
- uint32 len_acct_name)
-{
- DEBUG(5, ("init_sam_entry4\n"));
-
- sam->user_idx = user_idx;
- init_str_hdr(&sam->hdr_acct_name, len_acct_name+1, len_acct_name, len_acct_name != 0);
-}
-
-/*******************************************************************
-reads or writes a SAM_ENTRY4 structure.
-********************************************************************/
-
-static bool sam_io_sam_entry4(const char *desc, SAM_ENTRY4 * sam,
- prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_entry4");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("user_idx", ps, depth, &sam->user_idx))
- return False;
- if(!smb_io_strhdr("strhdr", &sam->hdr_acct_name, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_ENTRY5 structure.
-********************************************************************/
-
-static void init_sam_entry5(SAM_ENTRY5 * sam, uint32 grp_idx,
- uint32 len_grp_name)
-{
- DEBUG(5, ("init_sam_entry5\n"));
-
- sam->grp_idx = grp_idx;
- init_str_hdr(&sam->hdr_grp_name, len_grp_name, len_grp_name,
- len_grp_name != 0);
-}
-
-/*******************************************************************
-reads or writes a SAM_ENTRY5 structure.
-********************************************************************/
-
-static bool sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam,
- prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_entry5");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx))
- return False;
- if(!smb_io_strhdr("strhdr", &sam->hdr_grp_name, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_ENTRY structure.
-********************************************************************/
-
-void init_sam_entry(SAM_ENTRY *sam, UNISTR2 *uni2, uint32 rid)
-{
- DEBUG(10, ("init_sam_entry: %d\n", rid));
-
- sam->rid = rid;
- init_uni_hdr(&sam->hdr_name, uni2);
-}
-
-/*******************************************************************
-reads or writes a SAM_ENTRY structure.
-********************************************************************/
-
-static bool sam_io_sam_entry(const char *desc, SAM_ENTRY * sam,
- prs_struct *ps, int depth)
-{
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_entry");
- depth++;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("rid", ps, depth, &sam->rid))
- return False;
- if(!smb_io_unihdr("unihdr", &sam->hdr_name, ps, depth)) /* account name unicode string header */
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_ENUM_DOM_USERS structure.
-********************************************************************/
-
-void init_samr_q_enum_dom_users(SAMR_Q_ENUM_DOM_USERS * q_e, POLICY_HND *pol,
- uint32 start_idx,
- uint32 acb_mask, uint32 size)
-{
- DEBUG(5, ("init_samr_q_enum_dom_users\n"));
-
- q_e->pol = *pol;
-
- q_e->start_idx = start_idx; /* zero indicates lots */
- q_e->acb_mask = acb_mask;
- q_e->max_size = size;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_enum_dom_users(const char *desc, SAMR_Q_ENUM_DOM_USERS * q_e,
- prs_struct *ps, int depth)
-{
- if (q_e == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_enum_dom_users");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &q_e->pol, ps, depth))
- return False;
-
- if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
- return False;
- if(!prs_uint32("acb_mask ", ps, depth, &q_e->acb_mask))
- return False;
-
- if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-inits a SAMR_R_ENUM_DOM_USERS structure.
-********************************************************************/
-
-void init_samr_r_enum_dom_users(SAMR_R_ENUM_DOM_USERS * r_u,
- uint32 next_idx, uint32 num_sam_entries)
-{
- DEBUG(5, ("init_samr_r_enum_dom_users\n"));
-
- r_u->next_idx = next_idx;
-
- if (num_sam_entries != 0) {
- r_u->ptr_entries1 = 1;
- r_u->ptr_entries2 = 1;
- r_u->num_entries2 = num_sam_entries;
- r_u->num_entries3 = num_sam_entries;
-
- r_u->num_entries4 = num_sam_entries;
- } else {
- r_u->ptr_entries1 = 0;
- r_u->num_entries2 = num_sam_entries;
- r_u->ptr_entries2 = 1;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_enum_dom_users");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
- return False;
- if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
- return False;
-
- if (r_u->ptr_entries1 != 0) {
- if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
- return False;
- if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
- return False;
- if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
- return False;
-
- if (UNMARSHALLING(ps) && (r_u->num_entries2 != 0)) {
- r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY, r_u->num_entries2);
- r_u->uni_acct_name = PRS_ALLOC_MEM(ps,UNISTR2, r_u->num_entries2);
- }
-
- if ((r_u->sam == NULL || r_u->uni_acct_name == NULL) && r_u->num_entries2 != 0) {
- DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
- r_u->num_entries4 = 0;
- r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
- return False;
- }
-
- for (i = 0; i < r_u->num_entries2; i++) {
- if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
- return False;
- }
-
- for (i = 0; i < r_u->num_entries2; i++) {
- if(!smb_io_unistr2("", &r_u->uni_acct_name[i],r_u->sam[i].hdr_name.buffer, ps,depth))
- return False;
- }
-
- }
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_QUERY_DISPINFO structure.
-********************************************************************/
-
-void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol,
- uint16 switch_level, uint32 start_idx,
- uint32 max_entries, uint32 max_size)
-{
- DEBUG(5, ("init_samr_q_query_dispinfo\n"));
-
- q_e->domain_pol = *pol;
-
- q_e->switch_level = switch_level;
-
- q_e->start_idx = start_idx;
- q_e->max_entries = max_entries;
- q_e->max_size = max_size;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e,
- prs_struct *ps, int depth)
-{
- if (q_e == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &q_e->domain_pol, ps, depth))
- return False;
-
- if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
- return False;
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx))
- return False;
- if(!prs_uint32("max_entries ", ps, depth, &q_e->max_entries))
- return False;
- if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_DISPINFO_1 structure.
-********************************************************************/
-
-NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, SAM_DISPINFO_1 **sam,
- uint32 num_entries, uint32 start_idx,
- struct samr_displayentry *entries)
-{
- uint32 i;
-
- DEBUG(10, ("init_sam_dispinfo_1: num_entries: %d\n", num_entries));
-
- if (num_entries==0)
- return NT_STATUS_OK;
-
- *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_1, num_entries);
- if (*sam == NULL)
- return NT_STATUS_NO_MEMORY;
-
- (*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY1, num_entries);
- if ((*sam)->sam == NULL)
- return NT_STATUS_NO_MEMORY;
-
- (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR1, num_entries);
- if ((*sam)->str == NULL)
- return NT_STATUS_NO_MEMORY;
-
- for (i = 0; i < num_entries ; i++) {
- init_unistr2(&(*sam)->str[i].uni_acct_name,
- entries[i].account_name, UNI_FLAGS_NONE);
- init_unistr2(&(*sam)->str[i].uni_full_name,
- entries[i].fullname, UNI_FLAGS_NONE);
- init_unistr2(&(*sam)->str[i].uni_acct_desc,
- entries[i].description, UNI_FLAGS_NONE);
-
- init_sam_entry1(&(*sam)->sam[i], start_idx+i+1,
- &(*sam)->str[i].uni_acct_name,
- &(*sam)->str[i].uni_full_name,
- &(*sam)->str[i].uni_acct_desc,
- entries[i].rid, entries[i].acct_flags);
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam,
- uint32 num_entries,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (UNMARSHALLING(ps) && num_entries > 0) {
-
- if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY1, num_entries)) == NULL) {
- DEBUG(0, ("out of memory allocating SAM_ENTRY1\n"));
- return False;
- }
-
- if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR1, num_entries)) == NULL) {
- DEBUG(0, ("out of memory allocating SAM_STR1\n"));
- return False;
- }
- }
-
- for (i = 0; i < num_entries; i++) {
- if(!sam_io_sam_entry1("", &sam->sam[i], ps, depth))
- return False;
- }
-
- for (i = 0; i < num_entries; i++) {
- if(!sam_io_sam_str1("", &sam->str[i],
- sam->sam[i].hdr_acct_name.buffer,
- sam->sam[i].hdr_user_name.buffer,
- sam->sam[i].hdr_user_desc.buffer, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_DISPINFO_2 structure.
-********************************************************************/
-
-NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, SAM_DISPINFO_2 **sam,
- uint32 num_entries, uint32 start_idx,
- struct samr_displayentry *entries)
-{
- uint32 i;
-
- DEBUG(10, ("init_sam_dispinfo_2: num_entries: %d\n", num_entries));
-
- if (num_entries==0)
- return NT_STATUS_OK;
-
- *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_2, num_entries);
- if (*sam == NULL)
- return NT_STATUS_NO_MEMORY;
-
- (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY2, num_entries);
- if ((*sam)->sam == NULL)
- return NT_STATUS_NO_MEMORY;
-
- (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR2, num_entries);
- if ((*sam)->str == NULL)
- return NT_STATUS_NO_MEMORY;
-
- for (i = 0; i < num_entries; i++) {
- init_unistr2(&(*sam)->str[i].uni_srv_name,
- entries[i].account_name, UNI_FLAGS_NONE);
- init_unistr2(&(*sam)->str[i].uni_srv_desc,
- entries[i].description, UNI_FLAGS_NONE);
-
- init_sam_entry2(&(*sam)->sam[i], start_idx + i + 1,
- &(*sam)->str[i].uni_srv_name,
- &(*sam)->str[i].uni_srv_desc,
- entries[i].rid, entries[i].acct_flags);
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam,
- uint32 num_entries,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (UNMARSHALLING(ps) && num_entries > 0) {
-
- if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY2, num_entries)) == NULL) {
- DEBUG(0, ("out of memory allocating SAM_ENTRY2\n"));
- return False;
- }
-
- if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR2, num_entries)) == NULL) {
- DEBUG(0, ("out of memory allocating SAM_STR2\n"));
- return False;
- }
- }
-
- for (i = 0; i < num_entries; i++) {
- if(!sam_io_sam_entry2("", &sam->sam[i], ps, depth))
- return False;
- }
-
- for (i = 0; i < num_entries; i++) {
- if(!sam_io_sam_str2("", &sam->str[i],
- sam->sam[i].hdr_srv_name.buffer,
- sam->sam[i].hdr_srv_desc.buffer, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_DISPINFO_3 structure.
-********************************************************************/
-
-NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, SAM_DISPINFO_3 **sam,
- uint32 num_entries, uint32 start_idx,
- struct samr_displayentry *entries)
-{
- uint32 i;
-
- DEBUG(5, ("init_sam_dispinfo_3: num_entries: %d\n", num_entries));
-
- if (num_entries==0)
- return NT_STATUS_OK;
-
- *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_3, num_entries);
- if (*sam == NULL)
- return NT_STATUS_NO_MEMORY;
-
- if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY3, num_entries)))
- return NT_STATUS_NO_MEMORY;
-
- if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR3, num_entries)))
- return NT_STATUS_NO_MEMORY;
-
- for (i = 0; i < num_entries; i++) {
- DEBUG(11, ("init_sam_dispinfo_3: entry: %d\n",i));
-
- init_unistr2(&(*sam)->str[i].uni_grp_name,
- entries[i].account_name, UNI_FLAGS_NONE);
- init_unistr2(&(*sam)->str[i].uni_grp_desc,
- entries[i].description, UNI_FLAGS_NONE);
-
- init_sam_entry3(&(*sam)->sam[i], start_idx+i+1,
- &(*sam)->str[i].uni_grp_name,
- &(*sam)->str[i].uni_grp_desc,
- entries[i].rid);
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam,
- uint32 num_entries,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (UNMARSHALLING(ps) && num_entries > 0) {
-
- if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY3, num_entries)) == NULL) {
- DEBUG(0, ("out of memory allocating SAM_ENTRY3\n"));
- return False;
- }
-
- if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR3, num_entries)) == NULL) {
- DEBUG(0, ("out of memory allocating SAM_STR3\n"));
- return False;
- }
- }
-
- for (i = 0; i < num_entries; i++) {
- if(!sam_io_sam_entry3("", &sam->sam[i], ps, depth))
- return False;
- }
-
- for (i = 0; i < num_entries; i++) {
- if(!sam_io_sam_str3("", &sam->str[i],
- sam->sam[i].hdr_grp_name.buffer,
- sam->sam[i].hdr_grp_desc.buffer, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_DISPINFO_4 structure.
-********************************************************************/
-
-NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, SAM_DISPINFO_4 **sam,
- uint32 num_entries, uint32 start_idx,
- struct samr_displayentry *entries)
-{
- uint32 i;
-
- DEBUG(5, ("init_sam_dispinfo_4: num_entries: %d\n", num_entries));
-
- if (num_entries==0)
- return NT_STATUS_OK;
-
- *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_4, num_entries);
- if (*sam == NULL)
- return NT_STATUS_NO_MEMORY;
-
- (*sam)->sam = TALLOC_ARRAY(ctx, SAM_ENTRY4, num_entries);
- if ((*sam)->sam == NULL)
- return NT_STATUS_NO_MEMORY;
-
- (*sam)->str=TALLOC_ARRAY(ctx, SAM_STR4, num_entries);
- if ((*sam)->str == NULL)
- return NT_STATUS_NO_MEMORY;
-
- for (i = 0; i < num_entries; i++) {
- size_t len_sam_name = strlen(entries[i].account_name);
-
- DEBUG(11, ("init_sam_dispinfo_2: entry: %d\n",i));
-
- init_sam_entry4(&(*sam)->sam[i], start_idx + i + 1,
- len_sam_name);
-
- init_string2(&(*sam)->str[i].acct_name,
- entries[i].account_name, len_sam_name+1,
- len_sam_name);
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam,
- uint32 num_entries,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_4");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (UNMARSHALLING(ps) && num_entries > 0) {
-
- if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY4, num_entries)) == NULL) {
- DEBUG(0, ("out of memory allocating SAM_ENTRY4\n"));
- return False;
- }
-
- if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR4, num_entries)) == NULL) {
- DEBUG(0, ("out of memory allocating SAM_STR4\n"));
- return False;
- }
- }
-
- for (i = 0; i < num_entries; i++) {
- if(!sam_io_sam_entry4("", &sam->sam[i], ps, depth))
- return False;
- }
-
- for (i = 0; i < num_entries; i++) {
- if(!smb_io_string2("acct_name", &sam->str[i].acct_name,
- sam->sam[i].hdr_acct_name.buffer, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_DISPINFO_5 structure.
-********************************************************************/
-
-NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, SAM_DISPINFO_5 **sam,
- uint32 num_entries, uint32 start_idx,
- struct samr_displayentry *entries)
-{
- uint32 len_sam_name;
- uint32 i;
-
- DEBUG(5, ("init_sam_dispinfo_5: num_entries: %d\n", num_entries));
-
- if (num_entries==0)
- return NT_STATUS_OK;
-
- *sam = TALLOC_ZERO_ARRAY(ctx, SAM_DISPINFO_5, num_entries);
- if (*sam == NULL)
- return NT_STATUS_NO_MEMORY;
-
- if (!((*sam)->sam=TALLOC_ARRAY(ctx, SAM_ENTRY5, num_entries)))
- return NT_STATUS_NO_MEMORY;
-
- if (!((*sam)->str=TALLOC_ARRAY(ctx, SAM_STR5, num_entries)))
- return NT_STATUS_NO_MEMORY;
-
- for (i = 0; i < num_entries; i++) {
- DEBUG(11, ("init_sam_dispinfo_5: entry: %d\n",i));
-
- len_sam_name = strlen(entries[i].account_name);
-
- init_sam_entry5(&(*sam)->sam[i], start_idx+i+1, len_sam_name);
- init_string2(&(*sam)->str[i].grp_name, entries[i].account_name,
- len_sam_name+1, len_sam_name);
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam,
- uint32 num_entries,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (sam == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_5");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (UNMARSHALLING(ps) && num_entries > 0) {
-
- if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY5, num_entries)) == NULL) {
- DEBUG(0, ("out of memory allocating SAM_ENTRY5\n"));
- return False;
- }
-
- if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR5, num_entries)) == NULL) {
- DEBUG(0, ("out of memory allocating SAM_STR5\n"));
- return False;
- }
- }
-
- for (i = 0; i < num_entries; i++) {
- if(!sam_io_sam_entry5("", &sam->sam[i], ps, depth))
- return False;
- }
-
- for (i = 0; i < num_entries; i++) {
- if(!smb_io_string2("grp_name", &sam->str[i].grp_name,
- sam->sam[i].hdr_grp_name.buffer, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_DISPINFO structure.
-********************************************************************/
-
-void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u,
- uint32 num_entries, uint32 total_size, uint32 data_size,
- uint16 switch_level, SAM_DISPINFO_CTR * ctr,
- NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level));
-
- r_u->total_size = total_size;
-
- r_u->data_size = data_size;
-
- r_u->switch_level = switch_level;
- r_u->num_entries = num_entries;
-
- if (num_entries==0)
- r_u->ptr_entries = 0;
- else
- r_u->ptr_entries = 1;
-
- r_u->num_entries2 = num_entries;
- r_u->ctr = ctr;
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("total_size ", ps, depth, &r_u->total_size))
- return False;
- if(!prs_uint32("data_size ", ps, depth, &r_u->data_size))
- return False;
- if(!prs_uint16("switch_level", ps, depth, &r_u->switch_level))
- return False;
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
- return False;
- if(!prs_uint32("ptr_entries ", ps, depth, &r_u->ptr_entries))
- return False;
-
- if (r_u->ptr_entries==0) {
- if(!prs_align(ps))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
- }
-
- if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
- return False;
-
- switch (r_u->switch_level) {
- case 0x1:
- if(!sam_io_sam_dispinfo_1("users", r_u->ctr->sam.info1,
- r_u->num_entries, ps, depth))
- return False;
- break;
- case 0x2:
- if(!sam_io_sam_dispinfo_2("servers", r_u->ctr->sam.info2,
- r_u->num_entries, ps, depth))
- return False;
- break;
- case 0x3:
- if(!sam_io_sam_dispinfo_3("groups", r_u->ctr->sam.info3,
- r_u->num_entries, ps, depth))
- return False;
- break;
- case 0x4:
- if(!sam_io_sam_dispinfo_4("user list",
- r_u->ctr->sam.info4,
- r_u->num_entries, ps, depth))
- return False;
- break;
- case 0x5:
- if(!sam_io_sam_dispinfo_5("group list",
- r_u->ctr->sam.info5,
- r_u->num_entries, ps, depth))
- return False;
- break;
- default:
- DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n"));
- break;
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_OPEN_GROUP structure.
-********************************************************************/
-
-void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c,
- POLICY_HND *hnd,
- uint32 access_mask, uint32 rid)
-{
- DEBUG(5, ("init_samr_q_open_group\n"));
-
- q_c->domain_pol = *hnd;
- q_c->access_mask = access_mask;
- q_c->rid_group = rid;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_open_group");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
- return False;
-
- if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
- return False;
- if(!prs_uint32("rid_group", ps, depth, &q_u->rid_group))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_open_group");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a GROUP_INFO1 structure.
-********************************************************************/
-
-void init_samr_group_info1(GROUP_INFO1 * gr1,
- char *acct_name, char *acct_desc,
- uint32 num_members)
-{
- DEBUG(5, ("init_samr_group_info1\n"));
-
- gr1->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
- gr1->num_members = num_members;
-
- init_unistr2(&gr1->uni_acct_name, acct_name, UNI_FLAGS_NONE);
- init_uni_hdr(&gr1->hdr_acct_name, &gr1->uni_acct_name);
- init_unistr2(&gr1->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
- init_uni_hdr(&gr1->hdr_acct_desc, &gr1->uni_acct_desc);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_group_info1(const char *desc, GROUP_INFO1 * gr1,
- prs_struct *ps, int depth)
-{
- uint16 dummy = 1;
-
- if (gr1 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_group_info1");
- depth++;
-
- if(!prs_uint16("level", ps, depth, &dummy))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_unihdr("hdr_acct_name", &gr1->hdr_acct_name, ps, depth))
- return False;
-
- if(!prs_uint32("group_attr", ps, depth, &gr1->group_attr))
- return False;
- if(!prs_uint32("num_members", ps, depth, &gr1->num_members))
- return False;
-
- if(!smb_io_unihdr("hdr_acct_desc", &gr1->hdr_acct_desc, ps, depth))
- return False;
-
- if(!smb_io_unistr2("uni_acct_name", &gr1->uni_acct_name,
- gr1->hdr_acct_name.buffer, ps, depth))
- return False;
-
- if(!smb_io_unistr2("uni_acct_desc", &gr1->uni_acct_desc,
- gr1->hdr_acct_desc.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a GROUP_INFO2 structure.
-********************************************************************/
-
-void init_samr_group_info2(GROUP_INFO2 * gr2, const char *acct_name)
-{
- DEBUG(5, ("init_samr_group_info2\n"));
-
- gr2->level = 2;
- init_unistr2(&gr2->uni_acct_name, acct_name, UNI_FLAGS_NONE);
- init_uni_hdr(&gr2->hdr_acct_name, &gr2->uni_acct_name);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_group_info2(const char *desc, GROUP_INFO2 *gr2, prs_struct *ps, int depth)
-{
- if (gr2 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_group_info2");
- depth++;
-
- if(!prs_uint16("hdr_level", ps, depth, &gr2->level))
- return False;
-
- if(!smb_io_unihdr("hdr_acct_name", &gr2->hdr_acct_name, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_acct_name", &gr2->uni_acct_name,
- gr2->hdr_acct_name.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a GROUP_INFO3 structure.
-********************************************************************/
-
-void init_samr_group_info3(GROUP_INFO3 *gr3)
-{
- DEBUG(5, ("init_samr_group_info3\n"));
-
- gr3->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_group_info3(const char *desc, GROUP_INFO3 *gr3, prs_struct *ps, int depth)
-{
- if (gr3 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_group_info3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("group_attr", ps, depth, &gr3->group_attr))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a GROUP_INFO4 structure.
-********************************************************************/
-
-void init_samr_group_info4(GROUP_INFO4 * gr4, const char *acct_desc)
-{
- DEBUG(5, ("init_samr_group_info4\n"));
-
- gr4->level = 4;
- init_unistr2(&gr4->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
- init_uni_hdr(&gr4->hdr_acct_desc, &gr4->uni_acct_desc);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_group_info4(const char *desc, GROUP_INFO4 * gr4,
- prs_struct *ps, int depth)
-{
- if (gr4 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_group_info4");
- depth++;
-
- if(!prs_uint16("hdr_level", ps, depth, &gr4->level))
- return False;
- if(!smb_io_unihdr("hdr_acct_desc", &gr4->hdr_acct_desc, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_acct_desc", &gr4->uni_acct_desc,
- gr4->hdr_acct_desc.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a GROUP_INFO5 structure.
-********************************************************************/
-
-void init_samr_group_info5(GROUP_INFO5 * gr5,
- char *acct_name, char *acct_desc,
- uint32 num_members)
-{
- DEBUG(5, ("init_samr_group_info5\n"));
-
- gr5->group_attr = (SE_GROUP_MANDATORY|SE_GROUP_ENABLED_BY_DEFAULT); /* why not | SE_GROUP_ENABLED ? */
- gr5->num_members = num_members;
-
- init_unistr2(&gr5->uni_acct_name, acct_name, UNI_FLAGS_NONE);
- init_uni_hdr(&gr5->hdr_acct_name, &gr5->uni_acct_name);
- init_unistr2(&gr5->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
- init_uni_hdr(&gr5->hdr_acct_desc, &gr5->uni_acct_desc);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_group_info5(const char *desc, GROUP_INFO5 * gr5,
- prs_struct *ps, int depth)
-{
- uint16 dummy = 1;
-
- if (gr5 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_group_info5");
- depth++;
-
- if(!prs_uint16("level", ps, depth, &dummy))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_unihdr("hdr_acct_name", &gr5->hdr_acct_name, ps, depth))
- return False;
-
- if(!prs_uint32("group_attr", ps, depth, &gr5->group_attr))
- return False;
- if(!prs_uint32("num_members", ps, depth, &gr5->num_members))
- return False;
-
- if(!smb_io_unihdr("hdr_acct_desc", &gr5->hdr_acct_desc, ps, depth))
- return False;
-
- if(!smb_io_unistr2("uni_acct_name", &gr5->uni_acct_name,
- gr5->hdr_acct_name.buffer, ps, depth))
- return False;
-
- if(!smb_io_unistr2("uni_acct_desc", &gr5->uni_acct_desc,
- gr5->hdr_acct_desc.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr,
- prs_struct *ps, int depth)
-{
- if (UNMARSHALLING(ps))
- *ctr = PRS_ALLOC_MEM(ps,GROUP_INFO_CTR,1);
-
- if (*ctr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_group_info_ctr");
- depth++;
-
- if(!prs_uint16("switch_value1", ps, depth, &(*ctr)->switch_value1))
- return False;
-
- switch ((*ctr)->switch_value1) {
- case 1:
- if(!samr_io_group_info1("group_info1", &(*ctr)->group.info1, ps, depth))
- return False;
- break;
- case 2:
- if(!samr_io_group_info2("group_info2", &(*ctr)->group.info2, ps, depth))
- return False;
- break;
- case 3:
- if(!samr_io_group_info3("group_info3", &(*ctr)->group.info3, ps, depth))
- return False;
- break;
- case 4:
- if(!samr_io_group_info4("group_info4", &(*ctr)->group.info4, ps, depth))
- return False;
- break;
- case 5:
- if(!samr_io_group_info5("group_info5", &(*ctr)->group.info5, ps, depth))
- return False;
- break;
- default:
- DEBUG(0,("samr_group_info_ctr: unsupported switch level\n"));
- break;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_CREATE_DOM_GROUP structure.
-********************************************************************/
-
-void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e,
- POLICY_HND *pol, const char *acct_desc,
- uint32 access_mask)
-{
- DEBUG(5, ("init_samr_q_create_dom_group\n"));
-
- q_e->pol = *pol;
-
- init_unistr2(&q_e->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
- init_uni_hdr(&q_e->hdr_acct_desc, &q_e->uni_acct_desc);
-
- q_e->access_mask = access_mask;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_create_dom_group(const char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e,
- prs_struct *ps, int depth)
-{
- if (q_e == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_create_dom_group");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
- return False;
-
- if(!smb_io_unihdr("hdr_acct_desc", &q_e->hdr_acct_desc, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_acct_desc", &q_e->uni_acct_desc,
- q_e->hdr_acct_desc.buffer, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("access", ps, depth, &q_e->access_mask))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_create_dom_group(const char *desc, SAMR_R_CREATE_DOM_GROUP * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_create_dom_group");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
- return False;
-
- if(!prs_uint32("rid ", ps, depth, &r_u->rid))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_DELETE_DOM_GROUP structure.
-********************************************************************/
-
-void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c,
- POLICY_HND *hnd)
-{
- DEBUG(5, ("init_samr_q_delete_dom_group\n"));
-
- q_c->group_pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_delete_dom_group(const char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_delete_dom_group(const char *desc, SAMR_R_DELETE_DOM_GROUP * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_DEL_GROUPMEM structure.
-********************************************************************/
-
-void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM * q_e,
- POLICY_HND *pol, uint32 rid)
-{
- DEBUG(5, ("init_samr_q_del_groupmem\n"));
-
- q_e->pol = *pol;
- q_e->rid = rid;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_del_groupmem(const char *desc, SAMR_Q_DEL_GROUPMEM * q_e,
- prs_struct *ps, int depth)
-{
- if (q_e == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_del_groupmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
- return False;
-
- if(!prs_uint32("rid", ps, depth, &q_e->rid))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_DEL_GROUPMEM structure.
-********************************************************************/
-
-void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol,
- NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_del_groupmem\n"));
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_del_groupmem(const char *desc, SAMR_R_DEL_GROUPMEM * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_del_groupmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_ADD_GROUPMEM structure.
-********************************************************************/
-
-void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM * q_e,
- POLICY_HND *pol, uint32 rid)
-{
- DEBUG(5, ("init_samr_q_add_groupmem\n"));
-
- q_e->pol = *pol;
- q_e->rid = rid;
- q_e->unknown = 0x0005;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_add_groupmem(const char *desc, SAMR_Q_ADD_GROUPMEM * q_e,
- prs_struct *ps, int depth)
-{
- if (q_e == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_add_groupmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
- return False;
-
- if(!prs_uint32("rid ", ps, depth, &q_e->rid))
- return False;
- if(!prs_uint32("unknown", ps, depth, &q_e->unknown))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_ADD_GROUPMEM structure.
-********************************************************************/
-
-void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol,
- NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_add_groupmem\n"));
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_add_groupmem(const char *desc, SAMR_R_ADD_GROUPMEM * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_add_groupmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_SET_GROUPINFO structure.
-********************************************************************/
-
-void init_samr_q_set_groupinfo(SAMR_Q_SET_GROUPINFO * q_e,
- POLICY_HND *pol, GROUP_INFO_CTR * ctr)
-{
- DEBUG(5, ("init_samr_q_set_groupinfo\n"));
-
- q_e->pol = *pol;
- q_e->ctr = ctr;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_set_groupinfo(const char *desc, SAMR_Q_SET_GROUPINFO * q_e,
- prs_struct *ps, int depth)
-{
- if (q_e == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_set_groupinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
- return False;
-
- if(!samr_group_info_ctr("ctr", &q_e->ctr, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_SET_GROUPINFO structure.
-********************************************************************/
-
-void init_samr_r_set_groupinfo(SAMR_R_SET_GROUPINFO * r_u, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_set_groupinfo\n"));
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_set_groupinfo(const char *desc, SAMR_R_SET_GROUPINFO * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_set_groupinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_QUERY_GROUPINFO structure.
-********************************************************************/
-
-void init_samr_q_query_groupinfo(SAMR_Q_QUERY_GROUPINFO * q_e,
- POLICY_HND *pol, uint16 switch_level)
-{
- DEBUG(5, ("init_samr_q_query_groupinfo\n"));
-
- q_e->pol = *pol;
-
- q_e->switch_level = switch_level;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_query_groupinfo(const char *desc, SAMR_Q_QUERY_GROUPINFO * q_e,
- prs_struct *ps, int depth)
-{
- if (q_e == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_groupinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
- return False;
-
- if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_GROUPINFO structure.
-********************************************************************/
-
-void init_samr_r_query_groupinfo(SAMR_R_QUERY_GROUPINFO * r_u,
- GROUP_INFO_CTR * ctr, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_query_groupinfo\n"));
-
- r_u->ptr = (NT_STATUS_IS_OK(status) && ctr != NULL) ? 1 : 0;
- r_u->ctr = ctr;
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_query_groupinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
- return False;
-
- if (r_u->ptr != 0) {
- if(!samr_group_info_ctr("ctr", &r_u->ctr, ps, depth))
- return False;
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_QUERY_GROUPMEM structure.
-********************************************************************/
-
-void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM * q_c, POLICY_HND *hnd)
-{
- DEBUG(5, ("init_samr_q_query_groupmem\n"));
-
- q_c->group_pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_query_groupmem(const char *desc, SAMR_Q_QUERY_GROUPMEM * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_groupmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_GROUPMEM structure.
-********************************************************************/
-
-void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u,
- uint32 num_entries, uint32 *rid,
- uint32 *attr, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_query_groupmem\n"));
-
- if (NT_STATUS_IS_OK(status)) {
- r_u->ptr = 1;
- r_u->num_entries = num_entries;
-
- r_u->ptr_attrs = attr != NULL ? 1 : 0;
- r_u->ptr_rids = rid != NULL ? 1 : 0;
-
- r_u->num_rids = num_entries;
- r_u->rid = rid;
-
- r_u->num_attrs = num_entries;
- r_u->attr = attr;
- } else {
- r_u->ptr = 0;
- r_u->num_entries = 0;
- }
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (r_u == NULL)
- return False;
-
- if (UNMARSHALLING(ps))
- ZERO_STRUCTP(r_u);
-
- prs_debug(ps, depth, desc, "samr_io_r_query_groupmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
- return False;
- if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
- return False;
-
- if (r_u->ptr != 0) {
- if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
- return False;
- if(!prs_uint32("ptr_attrs", ps, depth, &r_u->ptr_attrs))
- return False;
-
- if (r_u->ptr_rids != 0) {
- if(!prs_uint32("num_rids", ps, depth, &r_u->num_rids))
- return False;
- if (UNMARSHALLING(ps) && r_u->num_rids != 0) {
- r_u->rid = PRS_ALLOC_MEM(ps,uint32,r_u->num_rids);
- if (r_u->rid == NULL)
- return False;
- }
-
- for (i = 0; i < r_u->num_rids; i++) {
- if(!prs_uint32("", ps, depth, &r_u->rid[i]))
- return False;
- }
- }
-
- if (r_u->ptr_attrs != 0) {
- if(!prs_uint32("num_attrs", ps, depth, &r_u->num_attrs))
- return False;
-
- if (UNMARSHALLING(ps) && r_u->num_attrs != 0) {
- r_u->attr = PRS_ALLOC_MEM(ps,uint32,r_u->num_attrs);
- if (r_u->attr == NULL)
- return False;
- }
-
- for (i = 0; i < r_u->num_attrs; i++) {
- if(!prs_uint32("", ps, depth, &r_u->attr[i]))
- return False;
- }
- }
- }
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_QUERY_USERGROUPS structure.
-********************************************************************/
-
-void init_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS * q_u,
- POLICY_HND *hnd)
-{
- DEBUG(5, ("init_samr_q_query_usergroups\n"));
-
- q_u->pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_query_usergroups(const char *desc, SAMR_Q_QUERY_USERGROUPS * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_usergroups");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_USERGROUPS structure.
-********************************************************************/
-
-void init_samr_r_query_usergroups(SAMR_R_QUERY_USERGROUPS * r_u,
- uint32 num_gids, DOM_GID * gid,
- NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_query_usergroups\n"));
-
- if (NT_STATUS_IS_OK(status)) {
- r_u->ptr_0 = 1;
- r_u->num_entries = num_gids;
- r_u->ptr_1 = (num_gids != 0) ? 1 : 0;
- r_u->num_entries2 = num_gids;
-
- r_u->gid = gid;
- } else {
- r_u->ptr_0 = 0;
- r_u->num_entries = 0;
- r_u->ptr_1 = 0;
- r_u->gid = NULL;
- }
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_gids(const char *desc, uint32 *num_gids, DOM_GID ** gid,
- prs_struct *ps, int depth)
-{
- uint32 i;
- if (gid == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_gids");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_gids", ps, depth, num_gids))
- return False;
-
- if ((*num_gids) != 0) {
- if (UNMARSHALLING(ps)) {
- (*gid) = PRS_ALLOC_MEM(ps,DOM_GID,*num_gids);
- }
-
- if ((*gid) == NULL) {
- return False;
- }
-
- for (i = 0; i < (*num_gids); i++) {
- if(!smb_io_gid("gids", &(*gid)[i], ps, depth))
- return False;
- }
- }
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_query_usergroups(const char *desc, SAMR_R_QUERY_USERGROUPS * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_query_usergroups");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
- return False;
-
- if (r_u->ptr_0 != 0) {
- if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries))
- return False;
- if(!prs_uint32("ptr_1 ", ps, depth, &r_u->ptr_1))
- return False;
-
- if (r_u->num_entries != 0 && r_u->ptr_1 != 0) {
- if(!samr_io_gids("gids", &r_u->num_entries2, &r_u->gid, ps, depth))
- return False;
- }
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_ENUM_DOMAINS structure.
-********************************************************************/
-
-void init_samr_q_enum_domains(SAMR_Q_ENUM_DOMAINS * q_e,
- POLICY_HND *pol,
- uint32 start_idx, uint32 size)
-{
- DEBUG(5, ("init_samr_q_enum_domains\n"));
-
- q_e->pol = *pol;
-
- q_e->start_idx = start_idx;
- q_e->max_size = size;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_enum_domains(const char *desc, SAMR_Q_ENUM_DOMAINS * q_e,
- prs_struct *ps, int depth)
-{
- if (q_e == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_enum_domains");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
- return False;
-
- if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
- return False;
- if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_ENUM_DOMAINS structure.
-********************************************************************/
-
-void init_samr_r_enum_domains(SAMR_R_ENUM_DOMAINS * r_u,
- uint32 next_idx, uint32 num_sam_entries)
-{
- DEBUG(5, ("init_samr_r_enum_domains\n"));
-
- r_u->next_idx = next_idx;
-
- if (num_sam_entries != 0) {
- r_u->ptr_entries1 = 1;
- r_u->ptr_entries2 = 1;
- r_u->num_entries2 = num_sam_entries;
- r_u->num_entries3 = num_sam_entries;
-
- r_u->num_entries4 = num_sam_entries;
- } else {
- r_u->ptr_entries1 = 0;
- r_u->num_entries2 = num_sam_entries;
- r_u->ptr_entries2 = 1;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_enum_domains(const char *desc, SAMR_R_ENUM_DOMAINS * r_u,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_enum_domains");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
- return False;
- if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
- return False;
-
- if (r_u->ptr_entries1 != 0) {
- if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
- return False;
- if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
- return False;
- if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
- return False;
-
- if (UNMARSHALLING(ps) && r_u->num_entries2) {
- r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
- r_u->uni_dom_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
- }
-
- if ((r_u->sam == NULL || r_u->uni_dom_name == NULL) && r_u->num_entries2 != 0) {
- DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
- r_u->num_entries4 = 0;
- r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
- return False;
- }
-
- for (i = 0; i < r_u->num_entries2; i++) {
- fstring tmp;
- slprintf(tmp, sizeof(tmp) - 1, "dom[%d]", i);
- if(!sam_io_sam_entry(tmp, &r_u->sam[i], ps, depth))
- return False;
- }
-
- for (i = 0; i < r_u->num_entries2; i++) {
- fstring tmp;
- slprintf(tmp, sizeof(tmp) - 1, "dom[%d]", i);
- if(!smb_io_unistr2(tmp, &r_u->uni_dom_name[i],
- r_u->sam[i].hdr_name.buffer, ps,
- depth))
- return False;
- }
-
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_ENUM_DOM_GROUPS structure.
-********************************************************************/
-
-void init_samr_q_enum_dom_groups(SAMR_Q_ENUM_DOM_GROUPS * q_e,
- POLICY_HND *pol,
- uint32 start_idx, uint32 size)
-{
- DEBUG(5, ("init_samr_q_enum_dom_groups\n"));
-
- q_e->pol = *pol;
-
- q_e->start_idx = start_idx;
- q_e->max_size = size;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_enum_dom_groups(const char *desc, SAMR_Q_ENUM_DOM_GROUPS * q_e,
- prs_struct *ps, int depth)
-{
- if (q_e == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_enum_dom_groups");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &(q_e->pol), ps, depth))
- return False;
-
- if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
- return False;
- if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_ENUM_DOM_GROUPS structure.
-********************************************************************/
-
-void init_samr_r_enum_dom_groups(SAMR_R_ENUM_DOM_GROUPS * r_u,
- uint32 next_idx, uint32 num_sam_entries)
-{
- DEBUG(5, ("init_samr_r_enum_dom_groups\n"));
-
- r_u->next_idx = next_idx;
-
- if (num_sam_entries != 0) {
- r_u->ptr_entries1 = 1;
- r_u->ptr_entries2 = 1;
- r_u->num_entries2 = num_sam_entries;
- r_u->num_entries3 = num_sam_entries;
-
- r_u->num_entries4 = num_sam_entries;
- } else {
- r_u->ptr_entries1 = 0;
- r_u->num_entries2 = num_sam_entries;
- r_u->ptr_entries2 = 1;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_enum_dom_groups(const char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_enum_dom_groups");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
- return False;
- if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
- return False;
-
- if (r_u->ptr_entries1 != 0) {
- if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
- return False;
- if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
- return False;
- if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
- return False;
-
- if (UNMARSHALLING(ps) && r_u->num_entries2) {
- r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
- r_u->uni_grp_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
- }
-
- if ((r_u->sam == NULL || r_u->uni_grp_name == NULL) && r_u->num_entries2 != 0) {
- DEBUG(0,
- ("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
- r_u->num_entries4 = 0;
- r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
- return False;
- }
-
- for (i = 0; i < r_u->num_entries2; i++) {
- if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
- return False;
- }
-
- for (i = 0; i < r_u->num_entries2; i++) {
- if(!smb_io_unistr2("", &r_u->uni_grp_name[i],
- r_u->sam[i].hdr_name.buffer, ps, depth))
- return False;
- }
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_ENUM_DOM_ALIASES structure.
-********************************************************************/
-
-void init_samr_q_enum_dom_aliases(SAMR_Q_ENUM_DOM_ALIASES * q_e,
- POLICY_HND *pol, uint32 start_idx,
- uint32 size)
-{
- DEBUG(5, ("init_samr_q_enum_dom_aliases\n"));
-
- q_e->pol = *pol;
-
- q_e->start_idx = start_idx;
- q_e->max_size = size;
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_enum_dom_aliases(const char *desc, SAMR_Q_ENUM_DOM_ALIASES * q_e,
- prs_struct *ps, int depth)
-{
- if (q_e == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_enum_dom_aliases");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth))
- return False;
-
- if(!prs_uint32("start_idx", ps, depth, &q_e->start_idx))
- return False;
- if(!prs_uint32("max_size ", ps, depth, &q_e->max_size))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_ENUM_DOM_ALIASES structure.
-********************************************************************/
-
-void init_samr_r_enum_dom_aliases(SAMR_R_ENUM_DOM_ALIASES *r_u, uint32 next_idx, uint32 num_sam_entries)
-{
- DEBUG(5, ("init_samr_r_enum_dom_aliases\n"));
-
- r_u->next_idx = next_idx;
-
- if (num_sam_entries != 0) {
- r_u->ptr_entries1 = 1;
- r_u->ptr_entries2 = 1;
- r_u->num_entries2 = num_sam_entries;
- r_u->num_entries3 = num_sam_entries;
-
- r_u->num_entries4 = num_sam_entries;
- } else {
- r_u->ptr_entries1 = 0;
- r_u->num_entries2 = num_sam_entries;
- r_u->ptr_entries2 = 1;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_enum_dom_aliases(const char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_enum_dom_aliases");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("next_idx ", ps, depth, &r_u->next_idx))
- return False;
- if(!prs_uint32("ptr_entries1", ps, depth, &r_u->ptr_entries1))
- return False;
-
- if (r_u->ptr_entries1 != 0) {
- if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2))
- return False;
- if(!prs_uint32("ptr_entries2", ps, depth, &r_u->ptr_entries2))
- return False;
- if(!prs_uint32("num_entries3", ps, depth, &r_u->num_entries3))
- return False;
-
- if (UNMARSHALLING(ps) && (r_u->num_entries2 > 0)) {
- r_u->sam = PRS_ALLOC_MEM(ps,SAM_ENTRY,r_u->num_entries2);
- r_u->uni_grp_name = PRS_ALLOC_MEM(ps,UNISTR2,r_u->num_entries2);
- }
-
- if (r_u->num_entries2 != 0 &&
- (r_u->sam == NULL || r_u->uni_grp_name == NULL)) {
- DEBUG(0,("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
- r_u->num_entries4 = 0;
- r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
- return False;
- }
-
- for (i = 0; i < r_u->num_entries2; i++) {
- if(!sam_io_sam_entry("", &r_u->sam[i], ps, depth))
- return False;
- }
-
- for (i = 0; i < r_u->num_entries2; i++) {
- if(!smb_io_unistr2("", &r_u->uni_grp_name[i],
- r_u->sam[i].hdr_name.buffer, ps,
- depth))
- return False;
- }
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_entries4", ps, depth, &r_u->num_entries4))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a ALIAS_INFO1 structure.
-********************************************************************/
-
-void init_samr_alias_info1(ALIAS_INFO1 * al1, char *acct_name, uint32 num_member, char *acct_desc)
-{
- DEBUG(5, ("init_samr_alias_info1\n"));
-
- init_unistr4(&al1->name, acct_name, UNI_FLAGS_NONE);
- al1->num_member = num_member;
- init_unistr4(&al1->description, acct_desc, UNI_FLAGS_NONE);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_alias_info1(const char *desc, ALIAS_INFO1 * al1,
- prs_struct *ps, int depth)
-{
- if (al1 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_alias_info1");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_unistr4_hdr("name", ps, depth, &al1->name) )
- return False;
- if ( !prs_uint32("num_member", ps, depth, &al1->num_member) )
- return False;
- if ( !prs_unistr4_hdr("description", ps, depth, &al1->description) )
- return False;
-
- if ( !prs_unistr4_str("name", ps, depth, &al1->name) )
- return False;
- if ( !prs_align(ps) )
- return False;
- if ( !prs_unistr4_str("description", ps, depth, &al1->description) )
- return False;
- if ( !prs_align(ps) )
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a ALIAS_INFO3 structure.
-********************************************************************/
-
-void init_samr_alias_info3(ALIAS_INFO3 * al3, const char *acct_desc)
-{
- DEBUG(5, ("init_samr_alias_info3\n"));
-
- init_unistr4(&al3->description, acct_desc, UNI_FLAGS_NONE);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_alias_info3(const char *desc, ALIAS_INFO3 *al3,
- prs_struct *ps, int depth)
-{
- if (al3 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_alias_info3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!prs_unistr4("description", ps, depth, &al3->description))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_alias_info2(const char *desc, ALIAS_INFO2 *al2,
- prs_struct *ps, int depth)
-{
- if (al2 == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_alias_info2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!prs_unistr4("name", ps, depth, &al2->name))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_alias_info_ctr(const char *desc, prs_struct *ps, int depth, ALIAS_INFO_CTR * ctr)
-{
- if ( !ctr )
- return False;
-
- prs_debug(ps, depth, desc, "samr_alias_info_ctr");
- depth++;
-
- if ( !prs_uint16("level", ps, depth, &ctr->level) )
- return False;
-
- if(!prs_align(ps))
- return False;
- switch (ctr->level) {
- case 1:
- if(!samr_io_alias_info1("alias_info1", &ctr->alias.info1, ps, depth))
- return False;
- break;
- case 2:
- if(!samr_io_alias_info2("alias_info2", &ctr->alias.info2, ps, depth))
- return False;
- break;
- case 3:
- if(!samr_io_alias_info3("alias_info3", &ctr->alias.info3, ps, depth))
- return False;
- break;
- default:
- DEBUG(0,("samr_alias_info_ctr: unsupported switch level\n"));
- break;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_QUERY_ALIASINFO structure.
-********************************************************************/
-
-void init_samr_q_query_aliasinfo(SAMR_Q_QUERY_ALIASINFO * q_e,
- POLICY_HND *pol, uint32 switch_level)
-{
- DEBUG(5, ("init_samr_q_query_aliasinfo\n"));
-
- q_e->pol = *pol;
- q_e->level = switch_level;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_query_aliasinfo(const char *desc, SAMR_Q_QUERY_ALIASINFO *in,
- prs_struct *ps, int depth)
-{
- if ( !in )
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_aliasinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !smb_io_pol_hnd("pol", &(in->pol), ps, depth) )
- return False;
-
- if ( !prs_uint16("level", ps, depth, &in->level) )
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_ALIASINFO structure.
-********************************************************************/
-
-void init_samr_r_query_aliasinfo(SAMR_R_QUERY_ALIASINFO *out,
- ALIAS_INFO_CTR * ctr, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_query_aliasinfo\n"));
-
- out->ctr = ctr;
- out->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out,
- prs_struct *ps, int depth)
-{
- if ( !out )
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_query_aliasinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if ( !prs_pointer("alias", ps, depth, (void*)&out->ctr, sizeof(ALIAS_INFO_CTR), (PRS_POINTER_CAST)samr_alias_info_ctr))
- return False;
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_SET_ALIASINFO structure.
-********************************************************************/
-
-void init_samr_q_set_aliasinfo(SAMR_Q_SET_ALIASINFO * q_u,
- POLICY_HND *hnd, ALIAS_INFO_CTR * ctr)
-{
- DEBUG(5, ("init_samr_q_set_aliasinfo\n"));
-
- q_u->alias_pol = *hnd;
- q_u->ctr = *ctr;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_set_aliasinfo(const char *desc, SAMR_Q_SET_ALIASINFO * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_set_aliasinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
- return False;
- if(!samr_alias_info_ctr("ctr", ps, depth, &q_u->ctr))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_set_aliasinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_QUERY_USERALIASES structure.
-********************************************************************/
-
-void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES * q_u,
- POLICY_HND *hnd,
- uint32 num_sids,
- uint32 *ptr_sid, DOM_SID2 * sid)
-{
- DEBUG(5, ("init_samr_q_query_useraliases\n"));
-
- q_u->pol = *hnd;
-
- q_u->num_sids1 = num_sids;
- q_u->ptr = 1;
- q_u->num_sids2 = num_sids;
-
- q_u->ptr_sid = ptr_sid;
- q_u->sid = sid;
-}
-
-/*******************************************************************
-reads or writes a SAMR_Q_QUERY_USERALIASES structure.
-********************************************************************/
-
-bool samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_u,
- prs_struct *ps, int depth)
-{
- fstring tmp;
- uint32 i;
-
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_useraliases");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
- return False;
-
- if(!prs_uint32("num_sids1", ps, depth, &q_u->num_sids1))
- return False;
- if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
- return False;
-
- if (q_u->ptr==0)
- return True;
-
- if(!prs_uint32("num_sids2", ps, depth, &q_u->num_sids2))
- return False;
-
- if (UNMARSHALLING(ps) && (q_u->num_sids2 != 0)) {
- q_u->ptr_sid = PRS_ALLOC_MEM(ps,uint32,q_u->num_sids2);
- if (q_u->ptr_sid == NULL)
- return False;
-
- q_u->sid = PRS_ALLOC_MEM(ps, DOM_SID2, q_u->num_sids2);
- if (q_u->sid == NULL)
- return False;
- }
-
- for (i = 0; i < q_u->num_sids2; i++) {
- slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i);
- if(!prs_uint32(tmp, ps, depth, &q_u->ptr_sid[i]))
- return False;
- }
-
- for (i = 0; i < q_u->num_sids2; i++) {
- if (q_u->ptr_sid[i] != 0) {
- slprintf(tmp, sizeof(tmp) - 1, "sid[%02d]", i);
- if(!smb_io_dom_sid2(tmp, &q_u->sid[i], ps, depth))
- return False;
- }
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_USERALIASES structure.
-********************************************************************/
-
-void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u,
- uint32 num_rids, uint32 *rid,
- NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_query_useraliases\n"));
-
- if (NT_STATUS_IS_OK(status)) {
- r_u->num_entries = num_rids;
- r_u->ptr = 1;
- r_u->num_entries2 = num_rids;
-
- r_u->rid = rid;
- } else {
- r_u->num_entries = 0;
- r_u->ptr = 0;
- r_u->num_entries2 = 0;
- }
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid,
- prs_struct *ps, int depth)
-{
- fstring tmp;
- uint32 i;
- if (rid == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_rids");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_rids", ps, depth, num_rids))
- return False;
-
- if ((*num_rids) != 0) {
- if (UNMARSHALLING(ps)) {
- /* reading */
- (*rid) = PRS_ALLOC_MEM(ps,uint32, *num_rids);
- }
- if ((*rid) == NULL)
- return False;
-
- for (i = 0; i < (*num_rids); i++) {
- slprintf(tmp, sizeof(tmp) - 1, "rid[%02d]", i);
- if(!prs_uint32(tmp, ps, depth, &((*rid)[i])))
- return False;
- }
- }
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_query_useraliases");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_entries", ps, depth, &r_u->num_entries))
- return False;
- if(!prs_uint32("ptr ", ps, depth, &r_u->ptr))
- return False;
-
- if (r_u->ptr != 0) {
- if(!samr_io_rids("rids", &r_u->num_entries2, &r_u->rid, ps, depth))
- return False;
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_OPEN_ALIAS structure.
-********************************************************************/
-
-void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol,
- uint32 access_mask, uint32 rid)
-{
- DEBUG(5, ("init_samr_q_open_alias\n"));
-
- q_u->dom_pol = *pol;
- q_u->access_mask = access_mask;
- q_u->rid_alias = rid;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_open_alias");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth))
- return False;
-
- if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
- return False;
- if(!prs_uint32("rid_alias", ps, depth, &q_u->rid_alias))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_open_alias");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_LOOKUP_RIDS structure.
-********************************************************************/
-
-void init_samr_q_lookup_rids(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_RIDS * q_u,
- POLICY_HND *pol, uint32 flags,
- uint32 num_rids, uint32 *rid)
-{
- DEBUG(5, ("init_samr_q_lookup_rids\n"));
-
- q_u->pol = *pol;
-
- q_u->num_rids1 = num_rids;
- q_u->flags = flags;
- q_u->ptr = 0;
- q_u->num_rids2 = num_rids;
- if (num_rids) {
- q_u->rid = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids );
- } else {
- q_u->rid = NULL;
- }
- if (q_u->rid == NULL) {
- q_u->num_rids1 = 0;
- q_u->num_rids2 = 0;
- } else {
- memcpy(q_u->rid, rid, num_rids * sizeof(q_u->rid[0]));
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_lookup_rids(const char *desc, SAMR_Q_LOOKUP_RIDS * q_u,
- prs_struct *ps, int depth)
-{
- uint32 i;
- fstring tmp;
-
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_lookup_rids");
- depth++;
-
- if (UNMARSHALLING(ps))
- ZERO_STRUCTP(q_u);
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
- return False;
-
- if(!prs_uint32("num_rids1", ps, depth, &q_u->num_rids1))
- return False;
- if(!prs_uint32("flags ", ps, depth, &q_u->flags))
- return False;
- if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
- return False;
- if(!prs_uint32("num_rids2", ps, depth, &q_u->num_rids2))
- return False;
-
- if (UNMARSHALLING(ps) && (q_u->num_rids2 != 0)) {
- q_u->rid = PRS_ALLOC_MEM(ps, uint32, q_u->num_rids2);
- if (q_u->rid == NULL)
- return False;
- }
-
- for (i = 0; i < q_u->num_rids2; i++) {
- slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
- if(!prs_uint32(tmp, ps, depth, &q_u->rid[i]))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_LOOKUP_RIDS structure.
-********************************************************************/
-
-void init_samr_r_lookup_rids(SAMR_R_LOOKUP_RIDS * r_u,
- uint32 num_names, UNIHDR * hdr_name,
- UNISTR2 *uni_name, uint32 *type)
-{
- DEBUG(5, ("init_samr_r_lookup_rids\n"));
-
- r_u->hdr_name = NULL;
- r_u->uni_name = NULL;
- r_u->type = NULL;
-
- if (num_names != 0) {
- r_u->num_names1 = num_names;
- r_u->ptr_names = 1;
- r_u->num_names2 = num_names;
-
- r_u->num_types1 = num_names;
- r_u->ptr_types = 1;
- r_u->num_types2 = num_names;
-
- r_u->hdr_name = hdr_name;
- r_u->uni_name = uni_name;
- r_u->type = type;
- } else {
- r_u->num_names1 = num_names;
- r_u->ptr_names = 0;
- r_u->num_names2 = num_names;
-
- r_u->num_types1 = num_names;
- r_u->ptr_types = 0;
- r_u->num_types2 = num_names;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u,
- prs_struct *ps, int depth)
-{
- uint32 i;
- fstring tmp;
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_lookup_rids");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_names1", ps, depth, &r_u->num_names1))
- return False;
- if(!prs_uint32("ptr_names ", ps, depth, &r_u->ptr_names))
- return False;
-
- if (r_u->ptr_names != 0) {
-
- if(!prs_uint32("num_names2", ps, depth, &r_u->num_names2))
- return False;
-
-
- if (UNMARSHALLING(ps) && (r_u->num_names2 != 0)) {
- r_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, r_u->num_names2);
- if (r_u->hdr_name == NULL)
- return False;
-
- r_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, r_u->num_names2);
- if (r_u->uni_name == NULL)
- return False;
- }
-
- for (i = 0; i < r_u->num_names2; i++) {
- slprintf(tmp, sizeof(tmp) - 1, "hdr[%02d] ", i);
- if(!smb_io_unihdr("", &r_u->hdr_name[i], ps, depth))
- return False;
- }
- for (i = 0; i < r_u->num_names2; i++) {
- slprintf(tmp, sizeof(tmp) - 1, "str[%02d] ", i);
- if(!smb_io_unistr2("", &r_u->uni_name[i], r_u->hdr_name[i].buffer, ps, depth))
- return False;
- }
-
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
- return False;
- if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
- return False;
-
- if (r_u->ptr_types != 0) {
-
- if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
- return False;
-
- if (UNMARSHALLING(ps) && (r_u->num_types2 != 0)) {
- r_u->type = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
- if (r_u->type == NULL)
- return False;
- }
-
- for (i = 0; i < r_u->num_types2; i++) {
- slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
- if(!prs_uint32(tmp, ps, depth, &r_u->type[i]))
- return False;
- }
- }
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_OPEN_ALIAS structure.
-********************************************************************/
-
-void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND *hnd)
-{
- DEBUG(5, ("init_samr_q_delete_alias\n"));
-
- q_u->alias_pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_delete_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_delete_alias");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_delete_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_delete_alias");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_CREATE_DOM_ALIAS structure.
-********************************************************************/
-
-void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u,
- POLICY_HND *hnd, const char *acct_desc)
-{
- DEBUG(5, ("init_samr_q_create_dom_alias\n"));
-
- q_u->dom_pol = *hnd;
-
- init_unistr2(&q_u->uni_acct_desc, acct_desc, UNI_FLAGS_NONE);
- init_uni_hdr(&q_u->hdr_acct_desc, &q_u->uni_acct_desc);
-
- q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_create_dom_alias(const char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("dom_pol", &q_u->dom_pol, ps, depth))
- return False;
-
- if(!smb_io_unihdr("hdr_acct_desc", &q_u->hdr_acct_desc, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_acct_desc", &q_u->uni_acct_desc,
- q_u->hdr_acct_desc.buffer, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_create_dom_alias(const char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("alias_pol", &r_u->alias_pol, ps, depth))
- return False;
-
- if(!prs_uint32("rid", ps, depth, &r_u->rid))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_ADD_ALIASMEM structure.
-********************************************************************/
-
-void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM * q_u, POLICY_HND *hnd,
- DOM_SID *sid)
-{
- DEBUG(5, ("init_samr_q_add_aliasmem\n"));
-
- q_u->alias_pol = *hnd;
- init_dom_sid2(&q_u->sid, sid);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
- return False;
- if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_DEL_ALIASMEM structure.
-********************************************************************/
-
-void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd,
- DOM_SID *sid)
-{
- DEBUG(5, ("init_samr_q_del_aliasmem\n"));
-
- q_u->alias_pol = *hnd;
- init_dom_sid2(&q_u->sid, sid);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
- return False;
- if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_DELETE_DOM_ALIAS structure.
-********************************************************************/
-
-void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c,
- POLICY_HND *hnd)
-{
- DEBUG(5, ("init_samr_q_delete_dom_alias\n"));
-
- q_c->alias_pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_delete_dom_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_DELETE_DOM_ALIAS structure.
-********************************************************************/
-
-void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u,
- NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_delete_dom_alias\n"));
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_delete_dom_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_QUERY_ALIASMEM structure.
-********************************************************************/
-
-void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM * q_c,
- POLICY_HND *hnd)
-{
- DEBUG(5, ("init_samr_q_query_aliasmem\n"));
-
- q_c->alias_pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_query_aliasmem(const char *desc, SAMR_Q_QUERY_ALIASMEM * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_aliasmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_ALIASMEM structure.
-********************************************************************/
-
-void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM * r_u,
- uint32 num_sids, DOM_SID2 * sid,
- NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_query_aliasmem\n"));
-
- if (NT_STATUS_IS_OK(status)) {
- r_u->num_sids = num_sids;
- r_u->ptr = (num_sids != 0) ? 1 : 0;
- r_u->num_sids1 = num_sids;
-
- r_u->sid = sid;
- } else {
- r_u->ptr = 0;
- r_u->num_sids = 0;
- }
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_sids ", ps, depth, &r_u->num_sids))
- return False;
- if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
- return False;
-
- if (r_u->ptr != 0 && r_u->num_sids != 0) {
- uint32 *ptr_sid = NULL;
-
- if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1))
- return False;
-
- /* We must always use talloc here even when marshalling. */
- if (r_u->num_sids1) {
- ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1);
- if (!ptr_sid) {
- return False;
- }
- } else {
- ptr_sid = NULL;
- }
-
- for (i = 0; i < r_u->num_sids1; i++) {
- ptr_sid[i] = 1;
- if(!prs_uint32("ptr_sid", ps, depth, &ptr_sid[i]))
- return False;
- }
-
- if (UNMARSHALLING(ps)) {
- if (r_u->num_sids1) {
- r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1);
- if (!r_u->sid) {
- return False;
- }
- } else {
- r_u->sid = NULL;
- }
- }
-
- for (i = 0; i < r_u->num_sids1; i++) {
- if (ptr_sid[i] != 0) {
- if(!smb_io_dom_sid2("sid", &r_u->sid[i], ps, depth))
- return False;
- }
- }
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_LOOKUP_NAMES structure.
-********************************************************************/
-
-NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u,
- POLICY_HND *pol, uint32 flags,
- uint32 num_names, const char **name)
-{
- uint32 i;
-
- DEBUG(5, ("init_samr_q_lookup_names\n"));
-
- q_u->pol = *pol;
-
- q_u->num_names1 = num_names;
- q_u->flags = flags;
- q_u->ptr = 0;
- q_u->num_names2 = num_names;
-
- if (num_names) {
- if (!(q_u->hdr_name = TALLOC_ZERO_ARRAY(ctx, UNIHDR, num_names)))
- return NT_STATUS_NO_MEMORY;
-
- if (!(q_u->uni_name = TALLOC_ZERO_ARRAY(ctx, UNISTR2, num_names)))
- return NT_STATUS_NO_MEMORY;
- } else {
- q_u->hdr_name = NULL;
- q_u->uni_name = NULL;
- }
-
- for (i = 0; i < num_names; i++) {
- init_unistr2(&q_u->uni_name[i], name[i], UNI_FLAGS_NONE); /* unicode string for machine account */
- init_uni_hdr(&q_u->hdr_name[i], &q_u->uni_name[i]); /* unicode header for user_name */
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u,
- prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_lookup_names");
- depth++;
-
- if (UNMARSHALLING(ps))
- ZERO_STRUCTP(q_u);
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
- return False;
-
- if(!prs_uint32("num_names1", ps, depth, &q_u->num_names1))
- return False;
- if(!prs_uint32("flags ", ps, depth, &q_u->flags))
- return False;
- if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
- return False;
- if(!prs_uint32("num_names2", ps, depth, &q_u->num_names2))
- return False;
-
- if (UNMARSHALLING(ps) && (q_u->num_names2 != 0)) {
- q_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_u->num_names2);
- q_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_u->num_names2);
- if (!q_u->hdr_name || !q_u->uni_name)
- return False;
- }
-
- for (i = 0; i < q_u->num_names2; i++) {
- if(!smb_io_unihdr("", &q_u->hdr_name[i], ps, depth))
- return False;
- }
-
- for (i = 0; i < q_u->num_names2; i++) {
- if(!smb_io_unistr2("", &q_u->uni_name[i], q_u->hdr_name[i].buffer, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_LOOKUP_NAMES structure.
-********************************************************************/
-
-NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u,
- uint32 num_rids,
- uint32 *rid, enum lsa_SidType *type,
- NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_lookup_names\n"));
-
- if (NT_STATUS_IS_OK(status) && (num_rids != 0)) {
- uint32 i;
-
- r_u->num_types1 = num_rids;
- r_u->ptr_types = 1;
- r_u->num_types2 = num_rids;
-
- r_u->num_rids1 = num_rids;
- r_u->ptr_rids = 1;
- r_u->num_rids2 = num_rids;
-
- if (!(r_u->rids = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
- return NT_STATUS_NO_MEMORY;
- if (!(r_u->types = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
- return NT_STATUS_NO_MEMORY;
-
- for (i = 0; i < num_rids; i++) {
- r_u->rids[i] = rid[i];
- r_u->types[i] = type[i];
- }
- } else {
-
- r_u->num_types1 = 0;
- r_u->ptr_types = 0;
- r_u->num_types2 = 0;
-
- r_u->num_rids1 = 0;
- r_u->ptr_rids = 0;
- r_u->num_rids2 = 0;
-
- r_u->rids = NULL;
- r_u->types = NULL;
- }
-
- r_u->status = status;
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u,
- prs_struct *ps, int depth)
-{
- uint32 i;
- fstring tmp;
-
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_lookup_names");
- depth++;
-
- if (UNMARSHALLING(ps))
- ZERO_STRUCTP(r_u);
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("num_rids1", ps, depth, &r_u->num_rids1))
- return False;
- if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids))
- return False;
-
- if (r_u->ptr_rids != 0) {
- if(!prs_uint32("num_rids2", ps, depth, &r_u->num_rids2))
- return False;
-
- if (r_u->num_rids2 != r_u->num_rids1) {
- /* RPC fault */
- return False;
- }
-
- if (UNMARSHALLING(ps) && r_u->num_rids2) {
- r_u->rids = PRS_ALLOC_MEM(ps, uint32, r_u->num_rids2);
-
- if (!r_u->rids) {
- DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n"));
- return False;
- }
- }
-
- for (i = 0; i < r_u->num_rids2; i++) {
- slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i);
- if(!prs_uint32(tmp, ps, depth, &r_u->rids[i]))
- return False;
- }
- }
-
- if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1))
- return False;
- if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types))
- return False;
-
- if (r_u->ptr_types != 0) {
- if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2))
- return False;
-
- if (r_u->num_types2 != r_u->num_types1) {
- /* RPC fault */
- return False;
- }
-
- if (UNMARSHALLING(ps) && r_u->num_types2) {
- r_u->types = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2);
-
- if (!r_u->types) {
- DEBUG(0, ("NULL types in samr_io_r_lookup_names\n"));
- return False;
- }
- }
-
- for (i = 0; i < r_u->num_types2; i++) {
- slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i);
- if(!prs_uint32(tmp, ps, depth, &r_u->types[i]))
- return False;
- }
- }
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_DELETE_DOM_USER structure.
-********************************************************************/
-
-void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c,
- POLICY_HND *hnd)
-{
- DEBUG(5, ("init_samr_q_delete_dom_user\n"));
-
- q_c->user_pol = *hnd;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_delete_dom_user(const char *desc, SAMR_Q_DELETE_DOM_USER * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_delete_dom_user");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_delete_dom_user(const char *desc, SAMR_R_DELETE_DOM_USER * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_delete_dom_user");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u,
- POLICY_HND *pol,
- uint32 access_mask, uint32 rid)
-{
- DEBUG(5, ("samr_init_samr_q_open_user\n"));
-
- q_u->domain_pol = *pol;
- q_u->access_mask = access_mask;
- q_u->user_rid = rid;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_open_user");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
- return False;
-
- if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
- return False;
- if(!prs_uint32("user_rid ", ps, depth, &q_u->user_rid))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_open_user");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u,
- POLICY_HND *pol,
- const char *name,
- uint32 acb_info, uint32 access_mask)
-{
- DEBUG(5, ("samr_init_samr_q_create_user\n"));
-
- q_u->domain_pol = *pol;
-
- init_unistr2(&q_u->uni_name, name, UNI_FLAGS_NONE);
- init_uni_hdr(&q_u->hdr_name, &q_u->uni_name);
-
- q_u->acb_info = acb_info;
- q_u->access_mask = access_mask;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_create_user");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
- return False;
-
- if(!smb_io_unihdr("hdr_name", &q_u->hdr_name, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_name", &q_u->uni_name, q_u->hdr_name.buffer, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("acb_info ", ps, depth, &q_u->acb_info))
- return False;
- if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_create_user");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth))
- return False;
-
- if(!prs_uint32("access_granted", ps, depth, &r_u->access_granted))
- return False;
- if(!prs_uint32("user_rid ", ps, depth, &r_u->user_rid))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_QUERY_USERINFO structure.
-********************************************************************/
-
-void init_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u,
- const POLICY_HND *hnd, uint16 switch_value)
-{
- DEBUG(5, ("init_samr_q_query_userinfo\n"));
-
- q_u->pol = *hnd;
- q_u->switch_value = switch_value;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_query_userinfo(const char *desc, SAMR_Q_QUERY_USERINFO * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_userinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
- return False;
-
- if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) /* 0x0015 or 0x0011 */
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a LOGON_HRS structure.
-********************************************************************/
-
-static bool sam_io_logon_hrs(const char *desc, LOGON_HRS * hrs,
- prs_struct *ps, int depth)
-{
- if (hrs == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_logon_hrs");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("maxlen", ps, depth, &hrs->max_len))
- return False;
-
- if(!prs_uint32("offset", ps, depth, &hrs->offset))
- return False;
-
- if(!prs_uint32("len ", ps, depth, &hrs->len))
- return False;
-
- if (hrs->len > sizeof(hrs->hours)) {
- DEBUG(3, ("sam_io_logon_hrs: truncating length from %d\n", hrs->len));
- hrs->len = sizeof(hrs->hours);
- }
-
- if(!prs_uint8s(False, "hours", ps, depth, hrs->hours, hrs->len))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_USER_INFO_18 structure.
-********************************************************************/
-
-void init_sam_user_info18(SAM_USER_INFO_18 * usr,
- const uint8 lm_pwd[16], const uint8 nt_pwd[16])
-{
- DEBUG(5, ("init_sam_user_info18\n"));
-
- usr->lm_pwd_active =
- memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd)) ? 1 : 0;
- usr->nt_pwd_active =
- memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd)) ? 1 : 0;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_user_info18(const char *desc, SAM_USER_INFO_18 * u,
- prs_struct *ps, int depth)
-{
- if (u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_user_info18");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint8s(False, "lm_pwd", ps, depth, u->lm_pwd, sizeof(u->lm_pwd)))
- return False;
- if(!prs_uint8s(False, "nt_pwd", ps, depth, u->nt_pwd, sizeof(u->nt_pwd)))
- return False;
-
- if(!prs_uint8("lm_pwd_active", ps, depth, &u->lm_pwd_active))
- return False;
- if(!prs_uint8("nt_pwd_active", ps, depth, &u->nt_pwd_active))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_USER_INFO_7 structure.
-********************************************************************/
-
-void init_sam_user_info7(SAM_USER_INFO_7 * usr, const char *name)
-{
- DEBUG(5, ("init_sam_user_info7\n"));
-
- init_unistr2(&usr->uni_name, name, UNI_FLAGS_NONE); /* unicode string for name */
- init_uni_hdr(&usr->hdr_name, &usr->uni_name); /* unicode header for name */
-
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_user_info7(const char *desc, SAM_USER_INFO_7 * usr,
- prs_struct *ps, int depth)
-{
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_user_info7");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_unihdr("unihdr", &usr->hdr_name, ps, depth))
- return False;
-
- if(!smb_io_unistr2("unistr2", &usr->uni_name, True, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_USER_INFO_9 structure.
-********************************************************************/
-
-void init_sam_user_info9(SAM_USER_INFO_9 * usr, uint32 rid_group)
-{
- DEBUG(5, ("init_sam_user_info9\n"));
-
- usr->rid_group = rid_group;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_user_info9(const char *desc, SAM_USER_INFO_9 * usr,
- prs_struct *ps, int depth)
-{
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_user_info9");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_USER_INFO_16 structure.
-********************************************************************/
-
-void init_sam_user_info16(SAM_USER_INFO_16 * usr, uint32 acb_info)
-{
- DEBUG(5, ("init_sam_user_info16\n"));
-
- usr->acb_info = acb_info;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_user_info16(const char *desc, SAM_USER_INFO_16 * usr,
- prs_struct *ps, int depth)
-{
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_user_info16");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("acb_info", ps, depth, &usr->acb_info))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_USER_INFO_17 structure.
-********************************************************************/
-
-void init_sam_user_info17(SAM_USER_INFO_17 * usr,
- NTTIME * expiry,
- char *mach_acct,
- uint32 rid_user, uint32 rid_group, uint16 acct_ctrl)
-{
- DEBUG(5, ("init_sam_user_info17\n"));
-
- memcpy(&usr->expiry, expiry, sizeof(usr->expiry)); /* expiry time or something? */
- ZERO_STRUCT(usr->padding_1); /* 0 - padding 24 bytes */
-
- usr->padding_2 = 0; /* 0 - padding 4 bytes */
-
- usr->ptr_1 = 1; /* pointer */
- ZERO_STRUCT(usr->padding_3); /* 0 - padding 32 bytes */
- usr->padding_4 = 0; /* 0 - padding 4 bytes */
-
- usr->ptr_2 = 1; /* pointer */
- usr->padding_5 = 0; /* 0 - padding 4 bytes */
-
- usr->ptr_3 = 1; /* pointer */
- ZERO_STRUCT(usr->padding_6); /* 0 - padding 32 bytes */
-
- usr->rid_user = rid_user;
- usr->rid_group = rid_group;
-
- usr->acct_ctrl = acct_ctrl;
- usr->unknown_3 = 0x0000;
-
- usr->unknown_4 = 0x003f; /* 0x003f - 16 bit unknown */
- usr->unknown_5 = 0x003c; /* 0x003c - 16 bit unknown */
-
- ZERO_STRUCT(usr->padding_7); /* 0 - padding 16 bytes */
- usr->padding_8 = 0; /* 0 - padding 4 bytes */
-
- init_unistr2(&usr->uni_mach_acct, mach_acct, UNI_FLAGS_NONE); /* unicode string for machine account */
- init_uni_hdr(&usr->hdr_mach_acct, &usr->uni_mach_acct); /* unicode header for machine account */
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_user_info17(const char *desc, SAM_USER_INFO_17 * usr,
- prs_struct *ps, int depth)
-{
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_unknown_17");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint8s(False, "padding_0", ps, depth, usr->padding_0, sizeof(usr->padding_0)))
- return False;
-
- if(!smb_io_time("time", &usr->expiry, ps, depth))
- return False;
-
- if(!prs_uint8s(False, "padding_1", ps, depth, usr->padding_1, sizeof(usr->padding_1)))
- return False;
-
- if(!smb_io_unihdr("unihdr", &usr->hdr_mach_acct, ps, depth))
- return False;
-
- if(!prs_uint32("padding_2", ps, depth, &usr->padding_2))
- return False;
-
- if(!prs_uint32("ptr_1 ", ps, depth, &usr->ptr_1))
- return False;
- if(!prs_uint8s(False, "padding_3", ps, depth, usr->padding_3, sizeof(usr->padding_3)))
- return False;
-
- if(!prs_uint32("padding_4", ps, depth, &usr->padding_4))
- return False;
-
- if(!prs_uint32("ptr_2 ", ps, depth, &usr->ptr_2))
- return False;
- if(!prs_uint32("padding_5", ps, depth, &usr->padding_5))
- return False;
-
- if(!prs_uint32("ptr_3 ", ps, depth, &usr->ptr_3))
- return False;
- if(!prs_uint8s(False, "padding_6", ps, depth, usr->padding_6,sizeof(usr->padding_6)))
- return False;
-
- if(!prs_uint32("rid_user ", ps, depth, &usr->rid_user))
- return False;
- if(!prs_uint32("rid_group", ps, depth, &usr->rid_group))
- return False;
- if(!prs_uint16("acct_ctrl", ps, depth, &usr->acct_ctrl))
- return False;
- if(!prs_uint16("unknown_3", ps, depth, &usr->unknown_3))
- return False;
- if(!prs_uint16("unknown_4", ps, depth, &usr->unknown_4))
- return False;
- if(!prs_uint16("unknown_5", ps, depth, &usr->unknown_5))
- return False;
-
- if(!prs_uint8s(False, "padding_7", ps, depth, usr->padding_7, sizeof(usr->padding_7)))
- return False;
-
- if(!prs_uint32("padding_8", ps, depth, &(usr->padding_8)))
- return False;
-
- if(!smb_io_unistr2("unistr2", &usr->uni_mach_acct, True, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint8s(False, "padding_9", ps, depth, usr->padding_9, sizeof(usr->padding_9)))
- return False;
-
- return True;
-}
-
-/*************************************************************************
- init_sam_user_infoa
- *************************************************************************/
-
-void init_sam_user_info24(SAM_USER_INFO_24 * usr, char newpass[516],
- uint8 pw_len)
-{
- DEBUG(10, ("init_sam_user_info24:\n"));
- memcpy(usr->pass, newpass, sizeof(usr->pass));
- usr->pw_len = pw_len;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_user_info24(const char *desc, SAM_USER_INFO_24 * usr,
- prs_struct *ps, int depth)
-{
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_user_info24");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint8s(False, "password", ps, depth, usr->pass,
- sizeof(usr->pass)))
- return False;
-
- if (MARSHALLING(ps) && (usr->pw_len != 0)) {
- if (!prs_uint8("pw_len", ps, depth, &usr->pw_len))
- return False;
- } else if (UNMARSHALLING(ps)) {
- if (!prs_uint8("pw_len", ps, depth, &usr->pw_len))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_user_info26(const char *desc, SAM_USER_INFO_26 * usr,
- prs_struct *ps, int depth)
-{
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_user_info26");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint8s(False, "password", ps, depth, usr->pass,
- sizeof(usr->pass)))
- return False;
-
- if (!prs_uint8("pw_len", ps, depth, &usr->pw_len))
- return False;
-
- return True;
-}
-
-
-/*************************************************************************
- init_sam_user_info23
-
- unknown_6 = 0x0000 04ec
-
- *************************************************************************/
-
-void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all zeros */
- NTTIME * logoff_time, /* all zeros */
- NTTIME * kickoff_time, /* all zeros */
- NTTIME * pass_last_set_time, /* all zeros */
- NTTIME * pass_can_change_time, /* all zeros */
- NTTIME * pass_must_change_time, /* all zeros */
- UNISTR2 *user_name,
- UNISTR2 *full_name,
- UNISTR2 *home_dir,
- UNISTR2 *dir_drive,
- UNISTR2 *log_scr,
- UNISTR2 *prof_path,
- UNISTR2 *desc,
- UNISTR2 *wkstas,
- UNISTR2 *unk_str,
- UNISTR2 *mung_dial,
- uint32 user_rid, /* 0x0000 0000 */
- uint32 group_rid,
- uint32 acb_info,
- uint32 fields_present,
- uint16 logon_divs,
- LOGON_HRS * hrs,
- uint16 bad_password_count,
- uint16 logon_count,
- char newpass[516])
-{
- usr->logon_time = *logon_time; /* all zeros */
- usr->logoff_time = *logoff_time; /* all zeros */
- usr->kickoff_time = *kickoff_time; /* all zeros */
- usr->pass_last_set_time = *pass_last_set_time; /* all zeros */
- usr->pass_can_change_time = *pass_can_change_time; /* all zeros */
- usr->pass_must_change_time = *pass_must_change_time; /* all zeros */
-
- ZERO_STRUCT(usr->nt_pwd);
- ZERO_STRUCT(usr->lm_pwd);
-
- usr->user_rid = user_rid; /* 0x0000 0000 */
- usr->group_rid = group_rid;
- usr->acb_info = acb_info;
- usr->fields_present = fields_present; /* 09f8 27fa */
-
- usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
- usr->ptr_logon_hrs = hrs ? 1 : 0;
-
- if (nt_time_is_zero(pass_must_change_time)) {
- usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
- } else {
- usr->passmustchange=0;
- }
-
- ZERO_STRUCT(usr->padding1);
- ZERO_STRUCT(usr->padding2);
-
- usr->bad_password_count = bad_password_count;
- usr->logon_count = logon_count;
-
- memcpy(usr->pass, newpass, sizeof(usr->pass));
-
- copy_unistr2(&usr->uni_user_name, user_name);
- init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
-
- copy_unistr2(&usr->uni_full_name, full_name);
- init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
-
- copy_unistr2(&usr->uni_home_dir, home_dir);
- init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
-
- copy_unistr2(&usr->uni_dir_drive, dir_drive);
- init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
-
- copy_unistr2(&usr->uni_logon_script, log_scr);
- init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
-
- copy_unistr2(&usr->uni_profile_path, prof_path);
- init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
-
- copy_unistr2(&usr->uni_acct_desc, desc);
- init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
-
- copy_unistr2(&usr->uni_workstations, wkstas);
- init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
-
- copy_unistr2(&usr->uni_comment, unk_str);
- init_uni_hdr(&usr->hdr_comment, &usr->uni_comment);
-
- copy_unistr2(&usr->uni_munged_dial, mung_dial);
- init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
-
- if (hrs) {
- memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
- } else {
- ZERO_STRUCT(usr->logon_hrs);
- }
-}
-
-/*************************************************************************
- init_sam_user_info23
-
- unknown_6 = 0x0000 04ec
-
- *************************************************************************/
-
-void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all zeros */
- NTTIME * logoff_time, /* all zeros */
- NTTIME * kickoff_time, /* all zeros */
- NTTIME * pass_last_set_time, /* all zeros */
- NTTIME * pass_can_change_time, /* all zeros */
- NTTIME * pass_must_change_time, /* all zeros */
- char *user_name, /* NULL */
- char *full_name,
- char *home_dir, char *dir_drive, char *log_scr,
- char *prof_path, const char *desc, char *wkstas,
- char *unk_str, char *mung_dial, uint32 user_rid, /* 0x0000 0000 */
- uint32 group_rid, uint32 acb_info,
- uint32 fields_present, uint16 logon_divs,
- LOGON_HRS * hrs, uint16 bad_password_count, uint16 logon_count,
- char newpass[516])
-{
- DATA_BLOB blob = base64_decode_data_blob(mung_dial);
-
- usr->logon_time = *logon_time; /* all zeros */
- usr->logoff_time = *logoff_time; /* all zeros */
- usr->kickoff_time = *kickoff_time; /* all zeros */
- usr->pass_last_set_time = *pass_last_set_time; /* all zeros */
- usr->pass_can_change_time = *pass_can_change_time; /* all zeros */
- usr->pass_must_change_time = *pass_must_change_time; /* all zeros */
-
- ZERO_STRUCT(usr->nt_pwd);
- ZERO_STRUCT(usr->lm_pwd);
-
- usr->user_rid = user_rid; /* 0x0000 0000 */
- usr->group_rid = group_rid;
- usr->acb_info = acb_info;
- usr->fields_present = fields_present; /* 09f8 27fa */
-
- usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
- usr->ptr_logon_hrs = hrs ? 1 : 0;
-
- if (nt_time_is_zero(pass_must_change_time)) {
- usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
- } else {
- usr->passmustchange=0;
- }
-
- ZERO_STRUCT(usr->padding1);
- ZERO_STRUCT(usr->padding2);
-
- usr->bad_password_count = bad_password_count;
- usr->logon_count = logon_count;
-
- memcpy(usr->pass, newpass, sizeof(usr->pass));
-
- 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_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);
-
- init_unistr2(&usr->uni_logon_script, log_scr, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
-
- init_unistr2(&usr->uni_profile_path, prof_path, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
-
- init_unistr2(&usr->uni_acct_desc, desc, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
-
- init_unistr2(&usr->uni_workstations, wkstas, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
-
- init_unistr2(&usr->uni_comment, unk_str, UNI_FLAGS_NONE);
- init_uni_hdr(&usr->hdr_comment, &usr->uni_comment);
-
- init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
- init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
-
- data_blob_free(&blob);
-
- if (hrs) {
- memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
- } else {
- ZERO_STRUCT(usr->logon_hrs);
- }
-}
-
-
-/*************************************************************************
- init_samr_user_info25P
- fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET | ACCT_FLAGS
-*************************************************************************/
-
-void init_sam_user_info25P(SAM_USER_INFO_25 * usr,
- uint32 fields_present, uint32 acb_info,
- char newpass[532])
-{
- usr->fields_present = fields_present;
- ZERO_STRUCT(usr->padding1);
- ZERO_STRUCT(usr->padding2);
-
- usr->acb_info = acb_info;
- memcpy(usr->pass, newpass, sizeof(usr->pass));
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr,
- prs_struct *ps, int depth)
-{
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_user_info23");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
- return False;
- if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
- return False;
- if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
- return False;
- if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps, depth))
- return False;
- if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps, depth))
- return False;
- if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
- 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_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 */
- 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_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
- return False;
- if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
- return False;
- if(!smb_io_unihdr("hdr_comment ", &usr->hdr_comment, ps, depth)) /* unknown string */
- return False;
- if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
- return False;
-
- if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
- return False;
- if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
- return False;
-
- if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
- return False;
- if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
- return False;
- if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
- return False;
-
- if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
- return False;
- if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
- return False;
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
- return False;
-
- if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
- return False;
- if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
- return False;
-
- if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
- return False;
- if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
- return False;
- if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
- return False;
-
-
- if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass)))
- return False;
-
- /* here begins pointed-to data */
-
- 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_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(!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_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
- return False;
-
- if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
- return False;
-
- if(!smb_io_unistr2("uni_comment ", &usr->uni_comment, usr->hdr_comment.buffer, ps, depth)) /* unknown string */
- return False;
-
- if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth))
- return False;
-
- /* ok, this is only guess-work (as usual) */
- if (usr->ptr_logon_hrs) {
- if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
- reads or writes a structure.
- NB. This structure is *definately* incorrect. It's my best guess
- currently for W2K SP2. The password field is encrypted in a different
- way than normal... And there are definately other problems. JRA.
-********************************************************************/
-
-static bool sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_struct *ps, int depth)
-{
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_user_info25");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
- return False;
- if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
- return False;
- if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
- return False;
- if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps, depth))
- return False;
- if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps, depth))
- return False;
- if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
- 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_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 */
- 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_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
- return False;
- if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
- return False;
- if(!smb_io_unihdr("hdr_comment ", &usr->hdr_comment, ps, depth)) /* unknown string */
- return False;
- if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
- return False;
-
- if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
- return False;
- if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
- return False;
-
- if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
- return False;
- if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
- return False;
- if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
- return False;
- if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
- return False;
-
- if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
- return False;
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
- return False;
-
- if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
- return False;
- if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
- return False;
-
- if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
- return False;
- if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
- return False;
- if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
- return False;
-
-
- if(!prs_uint8s(False, "password ", ps, depth, usr->pass, sizeof(usr->pass)))
- return False;
-
- /* here begins pointed-to data */
-
- 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_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(!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_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */
- return False;
-
- if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */
- return False;
-
- if(!smb_io_unistr2("uni_comment ", &usr->uni_comment, usr->hdr_comment.buffer, ps, depth)) /* unknown string */
- return False;
-
- if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth))
- return False;
-
- /* ok, this is only guess-work (as usual) */
- if (usr->ptr_logon_hrs) {
- if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
- return False;
- }
-
- return True;
-}
-
-
-/*************************************************************************
- init_sam_user_info21W
-
- unknown_6 = 0x0000 04ec
-
- *************************************************************************/
-
-void init_sam_user_info21W(SAM_USER_INFO_21 * usr,
- NTTIME * logon_time,
- NTTIME * logoff_time,
- NTTIME * kickoff_time,
- NTTIME * pass_last_set_time,
- NTTIME * pass_can_change_time,
- NTTIME * pass_must_change_time,
- UNISTR2 *user_name,
- UNISTR2 *full_name,
- UNISTR2 *home_dir,
- UNISTR2 *dir_drive,
- UNISTR2 *log_scr,
- UNISTR2 *prof_path,
- UNISTR2 *desc,
- UNISTR2 *wkstas,
- UNISTR2 *unk_str,
- UNISTR2 *mung_dial,
- uchar lm_pwd[16],
- uchar nt_pwd[16],
- uint32 user_rid,
- uint32 group_rid,
- uint32 acb_info,
- uint32 fields_present,
- uint16 logon_divs,
- LOGON_HRS * hrs,
- uint16 bad_password_count,
- uint16 logon_count)
-{
- 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;
-
- memcpy(usr->lm_pwd, lm_pwd, sizeof(usr->lm_pwd));
- memcpy(usr->nt_pwd, nt_pwd, sizeof(usr->nt_pwd));
-
- usr->user_rid = user_rid;
- usr->group_rid = group_rid;
- usr->acb_info = acb_info;
- usr->fields_present = fields_present; /* 0x00ff ffff */
-
- usr->logon_divs = logon_divs; /* should be 168 (hours/week) */
- usr->ptr_logon_hrs = hrs ? 1 : 0;
- usr->bad_password_count = bad_password_count;
- usr->logon_count = logon_count;
-
- if (nt_time_is_zero(pass_must_change_time)) {
- usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
- } else {
- usr->passmustchange=0;
- }
-
- ZERO_STRUCT(usr->padding1);
- ZERO_STRUCT(usr->padding2);
-
- copy_unistr2(&usr->uni_user_name, user_name);
- init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
-
- copy_unistr2(&usr->uni_full_name, full_name);
- init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
-
- copy_unistr2(&usr->uni_home_dir, home_dir);
- init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
-
- copy_unistr2(&usr->uni_dir_drive, dir_drive);
- init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
-
- copy_unistr2(&usr->uni_logon_script, log_scr);
- init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
-
- copy_unistr2(&usr->uni_profile_path, prof_path);
- init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
-
- copy_unistr2(&usr->uni_acct_desc, desc);
- init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
-
- copy_unistr2(&usr->uni_workstations, wkstas);
- init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
-
- copy_unistr2(&usr->uni_comment, unk_str);
- init_uni_hdr(&usr->hdr_comment, &usr->uni_comment);
-
- copy_unistr2(&usr->uni_munged_dial, mung_dial);
- init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
-
- if (hrs) {
- memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
- } else {
- ZERO_STRUCT(usr->logon_hrs);
- }
-}
-
-/*************************************************************************
- init_sam_user_info21
-
- unknown_6 = 0x0000 04ec
-
- *************************************************************************/
-
-NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID *domain_sid)
-{
- NTTIME logon_time, logoff_time, kickoff_time,
- pass_last_set_time, pass_can_change_time,
- pass_must_change_time;
-
- time_t must_change_time;
- const char* user_name = pdb_get_username(pw);
- const char* full_name = pdb_get_fullname(pw);
- const char* home_dir = pdb_get_homedir(pw);
- const char* dir_drive = pdb_get_dir_drive(pw);
- const char* logon_script = pdb_get_logon_script(pw);
- const char* profile_path = pdb_get_profile_path(pw);
- const char* description = pdb_get_acct_desc(pw);
- const char* workstations = pdb_get_workstations(pw);
- const char* munged_dial = pdb_get_munged_dial(pw);
- DATA_BLOB munged_dial_blob;
-
- uint32 user_rid;
- const DOM_SID *user_sid;
-
- uint32 group_rid;
- const DOM_SID *group_sid;
-
- if (munged_dial) {
- munged_dial_blob = base64_decode_data_blob(munged_dial);
- } else {
- munged_dial_blob = data_blob_null;
- }
-
- /* Create NTTIME structs */
- unix_to_nt_time (&logon_time, pdb_get_logon_time(pw));
- unix_to_nt_time (&logoff_time, pdb_get_logoff_time(pw));
- unix_to_nt_time (&kickoff_time, pdb_get_kickoff_time(pw));
- unix_to_nt_time (&pass_last_set_time, pdb_get_pass_last_set_time(pw));
- unix_to_nt_time (&pass_can_change_time,pdb_get_pass_can_change_time(pw));
- must_change_time = pdb_get_pass_must_change_time(pw);
- if (must_change_time == get_time_t_max())
- unix_to_nt_time_abs(&pass_must_change_time, must_change_time);
- else
- unix_to_nt_time(&pass_must_change_time, must_change_time);
-
- /* structure assignment */
- 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;
-
- ZERO_STRUCT(usr->nt_pwd);
- ZERO_STRUCT(usr->lm_pwd);
-
- user_sid = pdb_get_user_sid(pw);
-
- if (!sid_peek_check_rid(domain_sid, user_sid, &user_rid)) {
- DEBUG(0, ("init_sam_user_info_21A: User %s has SID %s, \nwhich conflicts with "
- "the domain sid %s. Failing operation.\n",
- user_name, sid_string_dbg(user_sid),
- sid_string_dbg(domain_sid)));
- data_blob_free(&munged_dial_blob);
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- become_root();
- group_sid = pdb_get_group_sid(pw);
- unbecome_root();
-
- if (!sid_peek_check_rid(domain_sid, group_sid, &group_rid)) {
- DEBUG(0, ("init_sam_user_info_21A: User %s has Primary Group SID %s, \n"
- "which conflicts with the domain sid %s. Failing operation.\n",
- user_name, sid_string_dbg(group_sid),
- sid_string_dbg(domain_sid)));
- data_blob_free(&munged_dial_blob);
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- usr->user_rid = user_rid;
- usr->group_rid = group_rid;
- usr->acb_info = pdb_get_acct_ctrl(pw);
-
- /*
- Look at a user on a real NT4 PDC with usrmgr, press
- 'ok'. Then you will see that fields_present is set to
- 0x08f827fa. Look at the user immediately after that again,
- and you will see that 0x00fffff is returned. This solves
- the problem that you get access denied after having looked
- at the user.
- -- Volker
- */
- usr->fields_present = pdb_build_fields_present(pw);
-
- usr->logon_divs = pdb_get_logon_divs(pw);
- usr->ptr_logon_hrs = pdb_get_hours(pw) ? 1 : 0;
- usr->bad_password_count = pdb_get_bad_password_count(pw);
- usr->logon_count = pdb_get_logon_count(pw);
-
- if (pdb_get_pass_must_change_time(pw) == 0) {
- usr->passmustchange=PASS_MUST_CHANGE_AT_NEXT_LOGON;
- } else {
- usr->passmustchange=0;
- }
-
- ZERO_STRUCT(usr->padding1);
- ZERO_STRUCT(usr->padding2);
-
- init_unistr2(&usr->uni_user_name, user_name, UNI_STR_TERMINATE);
- init_uni_hdr(&usr->hdr_user_name, &usr->uni_user_name);
-
- init_unistr2(&usr->uni_full_name, full_name, UNI_STR_TERMINATE);
- init_uni_hdr(&usr->hdr_full_name, &usr->uni_full_name);
-
- init_unistr2(&usr->uni_home_dir, home_dir, UNI_STR_TERMINATE);
- init_uni_hdr(&usr->hdr_home_dir, &usr->uni_home_dir);
-
- init_unistr2(&usr->uni_dir_drive, dir_drive, UNI_STR_TERMINATE);
- init_uni_hdr(&usr->hdr_dir_drive, &usr->uni_dir_drive);
-
- init_unistr2(&usr->uni_logon_script, logon_script, UNI_STR_TERMINATE);
- init_uni_hdr(&usr->hdr_logon_script, &usr->uni_logon_script);
-
- init_unistr2(&usr->uni_profile_path, profile_path, UNI_STR_TERMINATE);
- init_uni_hdr(&usr->hdr_profile_path, &usr->uni_profile_path);
-
- init_unistr2(&usr->uni_acct_desc, description, UNI_STR_TERMINATE);
- init_uni_hdr(&usr->hdr_acct_desc, &usr->uni_acct_desc);
-
- init_unistr2(&usr->uni_workstations, workstations, UNI_STR_TERMINATE);
- init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations);
-
- init_unistr2(&usr->uni_comment, NULL, UNI_STR_TERMINATE);
- init_uni_hdr(&usr->hdr_comment, &usr->uni_comment);
-
- init_unistr2_from_datablob(&usr->uni_munged_dial, &munged_dial_blob);
- init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
- data_blob_free(&munged_dial_blob);
-
- if (pdb_get_hours(pw)) {
- usr->logon_hrs.max_len = 1260;
- usr->logon_hrs.offset = 0;
- usr->logon_hrs.len = pdb_get_hours_len(pw);
- memcpy(&usr->logon_hrs.hours, pdb_get_hours(pw), MAX_HOURS_LEN);
- } else {
- usr->logon_hrs.max_len = 1260;
- usr->logon_hrs.offset = 0;
- usr->logon_hrs.len = 0;
- memset(&usr->logon_hrs, 0xff, sizeof(usr->logon_hrs));
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr,
- prs_struct *ps, int depth)
-{
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_user_info21");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_time("logon_time ", &usr->logon_time, ps, depth))
- return False;
- if(!smb_io_time("logoff_time ", &usr->logoff_time, ps, depth))
- return False;
- if(!smb_io_time("pass_last_set_time ", &usr->pass_last_set_time, ps,depth))
- return False;
- if(!smb_io_time("kickoff_time ", &usr->kickoff_time, ps, depth))
- return False;
- if(!smb_io_time("pass_can_change_time ", &usr->pass_can_change_time, ps,depth))
- return False;
- if(!smb_io_time("pass_must_change_time", &usr->pass_must_change_time, ps, depth))
- 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_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 */
- 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_acct_desc ", &usr->hdr_acct_desc, ps, depth)) /* account desc */
- return False;
- if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */
- return False;
- if(!smb_io_unihdr("hdr_comment ", &usr->hdr_comment, ps, depth)) /* unknown string */
- return False;
- if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
- return False;
-
- if(!prs_uint8s(False, "lm_pwd ", ps, depth, usr->lm_pwd, sizeof(usr->lm_pwd)))
- return False;
- if(!prs_uint8s(False, "nt_pwd ", ps, depth, usr->nt_pwd, sizeof(usr->nt_pwd)))
- return False;
-
- if(!prs_uint32("user_rid ", ps, depth, &usr->user_rid)) /* User ID */
- return False;
- if(!prs_uint32("group_rid ", ps, depth, &usr->group_rid)) /* Group ID */
- return False;
- if(!prs_uint32("acb_info ", ps, depth, &usr->acb_info))
- return False;
-
- if(!prs_uint32("fields_present ", ps, depth, &usr->fields_present))
- return False;
- if(!prs_uint16("logon_divs ", ps, depth, &usr->logon_divs)) /* logon divisions per week */
- return False;
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("ptr_logon_hrs ", ps, depth, &usr->ptr_logon_hrs))
- return False;
-
- if(!prs_uint16("bad_password_count ", ps, depth, &usr->bad_password_count))
- return False;
- if(!prs_uint16("logon_count ", ps, depth, &usr->logon_count))
- return False;
-
- if(!prs_uint8s(False, "padding1 ", ps, depth, usr->padding1, sizeof(usr->padding1)))
- return False;
- if(!prs_uint8("passmustchange ", ps, depth, &usr->passmustchange))
- return False;
- if(!prs_uint8("padding2 ", ps, depth, &usr->padding2))
- return False;
-
- /* here begins pointed-to data */
-
- if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name,usr->hdr_user_name.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_comment", &usr->uni_comment, usr->hdr_comment.buffer, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth))
- return False;
-
- /* ok, this is only guess-work (as usual) */
- if (usr->ptr_logon_hrs) {
- if(!sam_io_logon_hrs("logon_hrs", &usr->logon_hrs, ps, depth))
- return False;
- }
-
- return True;
-}
-
-void init_sam_user_info20A(SAM_USER_INFO_20 *usr, struct samu *pw)
-{
- const char *munged_dial = pdb_get_munged_dial(pw);
- DATA_BLOB blob;
-
- if (munged_dial) {
- blob = base64_decode_data_blob(munged_dial);
- } else {
- blob = data_blob_null;
- }
-
- init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
- init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
- data_blob_free(&blob);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool sam_io_user_info20(const char *desc, SAM_USER_INFO_20 *usr,
- prs_struct *ps, int depth)
-{
- if (usr == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "sam_io_user_info20");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */
- return False;
-
- if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth)) /* worksations user can log on from */
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAM_USERINFO_CTR structure.
-********************************************************************/
-
-NTSTATUS make_samr_userinfo_ctr_usr21(TALLOC_CTX *ctx, SAM_USERINFO_CTR * ctr,
- uint16 switch_value,
- SAM_USER_INFO_21 * usr)
-{
- DEBUG(5, ("make_samr_userinfo_ctr_usr21\n"));
-
- ctr->switch_value = switch_value;
- ctr->info.id = NULL;
-
- switch (switch_value) {
- case 16:
- ctr->info.id16 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_16);
- if (ctr->info.id16 == NULL)
- return NT_STATUS_NO_MEMORY;
-
- init_sam_user_info16(ctr->info.id16, usr->acb_info);
- break;
-#if 0
-/* whoops - got this wrong. i think. or don't understand what's happening. */
- case 17:
- {
- NTTIME expire;
- info = (void *)&id11;
-
- expire.low = 0xffffffff;
- expire.high = 0x7fffffff;
-
- ctr->info.id = TALLOC_ZERO_P(ctx,SAM_USER_INFO_17);
- init_sam_user_info11(ctr->info.id17, &expire,
- "BROOKFIELDS$", /* name */
- 0x03ef, /* user rid */
- 0x201, /* group rid */
- 0x0080); /* acb info */
-
- break;
- }
-#endif
- case 18:
- ctr->info.id18 = TALLOC_ZERO_P(ctx,SAM_USER_INFO_18);
- if (ctr->info.id18 == NULL)
- return NT_STATUS_NO_MEMORY;
-
- init_sam_user_info18(ctr->info.id18, usr->lm_pwd, usr->nt_pwd);
- break;
- case 21:
- {
- SAM_USER_INFO_21 *cusr;
- cusr = TALLOC_ZERO_P(ctx,SAM_USER_INFO_21);
- ctr->info.id21 = cusr;
- if (ctr->info.id21 == NULL)
- return NT_STATUS_NO_MEMORY;
- memcpy(cusr, usr, sizeof(*usr));
- memset(cusr->lm_pwd, 0, sizeof(cusr->lm_pwd));
- memset(cusr->nt_pwd, 0, sizeof(cusr->nt_pwd));
- break;
- }
- default:
- DEBUG(4,("make_samr_userinfo_ctr: unsupported info\n"));
- return NT_STATUS_INVALID_INFO_CLASS;
- }
-
- return NT_STATUS_OK;
-}
-
-/*******************************************************************
-inits a SAM_USERINFO_CTR structure.
-********************************************************************/
-
-static void init_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr, DATA_BLOB *sess_key,
- uint16 switch_value, void *info)
-{
- DEBUG(5, ("init_samr_userinfo_ctr\n"));
-
- ctr->switch_value = switch_value;
- ctr->info.id = info;
-
- switch (switch_value) {
- case 0x18:
- SamOEMhashBlob(ctr->info.id24->pass, 516, sess_key);
- dump_data(100, sess_key->data, sess_key->length);
- dump_data(100, ctr->info.id24->pass, 516);
- break;
- case 0x17:
- SamOEMhashBlob(ctr->info.id23->pass, 516, sess_key);
- dump_data(100, sess_key->data, sess_key->length);
- dump_data(100, ctr->info.id23->pass, 516);
- break;
- case 0x07:
- break;
- default:
- DEBUG(4,("init_samr_userinfo_ctr: unsupported switch level: %d\n", switch_value));
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-static bool samr_io_userinfo_ctr(const char *desc, SAM_USERINFO_CTR **ppctr,
- prs_struct *ps, int depth)
-{
- bool ret;
- SAM_USERINFO_CTR *ctr;
-
- prs_debug(ps, depth, desc, "samr_io_userinfo_ctr");
- depth++;
-
- if (UNMARSHALLING(ps)) {
- ctr = PRS_ALLOC_MEM(ps,SAM_USERINFO_CTR,1);
- if (ctr == NULL)
- return False;
- *ppctr = ctr;
- } else {
- ctr = *ppctr;
- }
-
- /* lkclXXXX DO NOT ALIGN BEFORE READING SWITCH VALUE! */
-
- if(!prs_uint16("switch_value", ps, depth, &ctr->switch_value))
- return False;
- if(!prs_align(ps))
- return False;
-
- ret = False;
-
- switch (ctr->switch_value) {
- case 7:
- if (UNMARSHALLING(ps))
- ctr->info.id7 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_7,1);
- if (ctr->info.id7 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info7("", ctr->info.id7, ps, depth);
- break;
- case 9:
- if (UNMARSHALLING(ps))
- ctr->info.id9 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_9,1);
- if (ctr->info.id9 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info9("", ctr->info.id9, ps, depth);
- break;
- case 16:
- if (UNMARSHALLING(ps))
- ctr->info.id16 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_16,1);
- if (ctr->info.id16 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info16("", ctr->info.id16, ps, depth);
- break;
- case 17:
- if (UNMARSHALLING(ps))
- ctr->info.id17 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_17,1);
-
- if (ctr->info.id17 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info17("", ctr->info.id17, ps, depth);
- break;
- case 18:
- if (UNMARSHALLING(ps))
- ctr->info.id18 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_18,1);
-
- if (ctr->info.id18 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info18("", ctr->info.id18, ps, depth);
- break;
- case 20:
- if (UNMARSHALLING(ps))
- ctr->info.id20 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_20,1);
-
- if (ctr->info.id20 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info20("", ctr->info.id20, ps, depth);
- break;
- case 21:
- if (UNMARSHALLING(ps))
- ctr->info.id21 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_21,1);
-
- if (ctr->info.id21 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info21("", ctr->info.id21, ps, depth);
- break;
- case 23:
- if (UNMARSHALLING(ps))
- ctr->info.id23 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_23,1);
-
- if (ctr->info.id23 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info23("", ctr->info.id23, ps, depth);
- break;
- case 24:
- if (UNMARSHALLING(ps))
- ctr->info.id24 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_24,1);
-
- if (ctr->info.id24 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info24("", ctr->info.id24, ps, depth);
- break;
- case 25:
- if (UNMARSHALLING(ps))
- ctr->info.id25 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_25,1);
-
- if (ctr->info.id25 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info25("", ctr->info.id25, ps, depth);
- break;
- case 26:
- if (UNMARSHALLING(ps))
- ctr->info.id26 = PRS_ALLOC_MEM(ps,SAM_USER_INFO_26,1);
-
- if (ctr->info.id26 == NULL) {
- DEBUG(2,("samr_io_userinfo_ctr: info pointer not initialised\n"));
- return False;
- }
- ret = sam_io_user_info26("", ctr->info.id26, ps, depth);
- break;
- default:
- DEBUG(2, ("samr_io_userinfo_ctr: unknown switch level 0x%x\n", ctr->switch_value));
- ret = False;
- break;
- }
-
- return ret;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_USERINFO structure.
-********************************************************************/
-
-void init_samr_r_query_userinfo(SAMR_R_QUERY_USERINFO * r_u,
- SAM_USERINFO_CTR * ctr, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_query_userinfo\n"));
-
- r_u->ptr = 0;
- r_u->ctr = NULL;
-
- if (NT_STATUS_IS_OK(status)) {
- r_u->ptr = 1;
- r_u->ctr = ctr;
- }
-
- r_u->status = status; /* return status */
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_query_userinfo(const char *desc, SAMR_R_QUERY_USERINFO * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_query_userinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr", ps, depth, &r_u->ptr))
- return False;
-
- if (r_u->ptr != 0) {
- if(!samr_io_userinfo_ctr("ctr", &r_u->ctr, ps, depth))
- return False;
- }
-
- if(!prs_align(ps))
- return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_SET_USERINFO structure.
-********************************************************************/
-
-void init_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u,
- const POLICY_HND *hnd, DATA_BLOB *sess_key,
- uint16 switch_value, void *info)
-{
- DEBUG(5, ("init_samr_q_set_userinfo\n"));
-
- q_u->pol = *hnd;
- q_u->switch_value = switch_value;
- init_samr_userinfo_ctr(q_u->ctr, sess_key, switch_value, info);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_set_userinfo(const char *desc, SAMR_Q_SET_USERINFO * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_set_userinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
-
- if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
- return False;
- if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_SET_USERINFO structure.
-********************************************************************/
-
-void init_samr_r_set_userinfo(SAMR_R_SET_USERINFO * r_u, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_set_userinfo\n"));
-
- r_u->status = status; /* return status */
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_set_userinfo(const char *desc, SAMR_R_SET_USERINFO * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_set_userinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_SET_USERINFO2 structure.
-********************************************************************/
-
-void init_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u,
- const POLICY_HND *hnd, DATA_BLOB *sess_key,
- uint16 switch_value, SAM_USERINFO_CTR * ctr)
-{
- DEBUG(5, ("init_samr_q_set_userinfo2\n"));
-
- q_u->pol = *hnd;
- q_u->switch_value = switch_value;
- q_u->ctr = ctr;
-
- q_u->ctr->switch_value = switch_value;
-
- switch (switch_value) {
- case 18:
- SamOEMhashBlob(ctr->info.id18->lm_pwd, 16, sess_key);
- SamOEMhashBlob(ctr->info.id18->nt_pwd, 16, sess_key);
- dump_data(100, sess_key->data, sess_key->length);
- dump_data(100, ctr->info.id18->lm_pwd, 16);
- dump_data(100, ctr->info.id18->nt_pwd, 16);
- break;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_set_userinfo2(const char *desc, SAMR_Q_SET_USERINFO2 * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_set_userinfo2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth))
- return False;
-
- if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
- return False;
- if(!samr_io_userinfo_ctr("ctr", &q_u->ctr, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_SET_USERINFO2 structure.
-********************************************************************/
-
-void init_samr_r_set_userinfo2(SAMR_R_SET_USERINFO2 * r_u, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_set_userinfo2\n"));
-
- r_u->status = status; /* return status */
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_set_userinfo2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_CONNECT structure.
-********************************************************************/
-
-void init_samr_q_connect(SAMR_Q_CONNECT * q_u,
- char *srv_name, uint32 access_mask)
-{
- DEBUG(5, ("init_samr_q_connect\n"));
-
- /* make PDC server name \\server */
- q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
- init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
-
- /* example values: 0x0000 0002 */
- q_u->access_mask = access_mask;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_connect");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
- return False;
- if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_connect");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_CONNECT4 structure.
-********************************************************************/
-
-void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u,
- char *srv_name, uint32 access_mask)
-{
- DEBUG(5, ("init_samr_q_connect4\n"));
-
- /* make PDC server name \\server */
- q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
- init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
-
- /* Only value we've seen, possibly an address type ? */
- q_u->unk_0 = 2;
-
- /* example values: 0x0000 0002 */
- q_u->access_mask = access_mask;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_connect4");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
- return False;
- if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("unk_0", ps, depth, &q_u->unk_0))
- return False;
- if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_connect4");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_CONNECT5 structure.
-********************************************************************/
-
-void init_samr_q_connect5(SAMR_Q_CONNECT5 * q_u,
- char *srv_name, uint32 access_mask)
-{
- DEBUG(5, ("init_samr_q_connect5\n"));
-
- /* make PDC server name \\server */
- q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0;
- init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE);
-
- /* example values: 0x0000 0002 */
- q_u->access_mask = access_mask;
-
- q_u->level = 1;
- q_u->info1_unk1 = 3;
- q_u->info1_unk2 = 0;
-}
-
-/*******************************************************************
-inits a SAMR_R_CONNECT5 structure.
-********************************************************************/
-
-void init_samr_r_connect5(SAMR_R_CONNECT5 * r_u, POLICY_HND *pol, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_q_connect5\n"));
-
- r_u->level = 1;
- r_u->info1_unk1 = 3;
- r_u->info1_unk2 = 0;
-
- r_u->connect_pol = *pol;
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_connect5(const char *desc, SAMR_Q_CONNECT5 * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_connect5");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name))
- return False;
- if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
- return False;
-
- if(!prs_uint32("level", ps, depth, &q_u->level))
- return False;
- if(!prs_uint32("level", ps, depth, &q_u->level))
- return False;
-
- if(!prs_uint32("info1_unk1", ps, depth, &q_u->info1_unk1))
- return False;
- if(!prs_uint32("info1_unk2", ps, depth, &q_u->info1_unk2))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_connect5(const char *desc, SAMR_R_CONNECT5 * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_connect5");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("level", ps, depth, &r_u->level))
- return False;
- if(!prs_uint32("level", ps, depth, &r_u->level))
- return False;
- if(!prs_uint32("info1_unk1", ps, depth, &r_u->info1_unk1))
- return False;
- if(!prs_uint32("info1_unk2", ps, depth, &r_u->info1_unk2))
- return False;
-
- if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_CONNECT_ANON structure.
-********************************************************************/
-
-void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u)
-{
- DEBUG(5, ("init_samr_q_connect_anon\n"));
-
- q_u->ptr = 1;
- q_u->unknown_0 = 0x5c; /* server name (?!!) */
- q_u->access_mask = MAXIMUM_ALLOWED_ACCESS;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_connect_anon");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
- return False;
- if (q_u->ptr) {
- if(!prs_uint16("unknown_0", ps, depth, &q_u->unknown_0))
- return False;
- }
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_connect_anon");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_GET_DOM_PWINFO structure.
-********************************************************************/
-
-void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u,
- char *srv_name)
-{
- DEBUG(5, ("init_samr_q_get_dom_pwinfo\n"));
-
- q_u->ptr = 1;
- init_unistr2(&q_u->uni_srv_name, srv_name, UNI_FLAGS_NONE);
- init_uni_hdr(&q_u->hdr_srv_name, &q_u->uni_srv_name);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_get_dom_pwinfo(const char *desc, SAMR_Q_GET_DOM_PWINFO * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_get_dom_pwinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr", ps, depth, &q_u->ptr))
- return False;
- if (q_u->ptr != 0) {
- if(!smb_io_unihdr("", &q_u->hdr_srv_name, ps, depth))
- return False;
- if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->hdr_srv_name.buffer, ps, depth))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_get_dom_pwinfo");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length))
- return False;
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-make a SAMR_ENC_PASSWD structure.
-********************************************************************/
-
-void init_enc_passwd(SAMR_ENC_PASSWD * pwd, const char pass[512])
-{
- ZERO_STRUCTP(pwd);
-
- if (pass == NULL) {
- pwd->ptr = 0;
- } else {
- pwd->ptr = 1;
- memcpy(pwd->pass, pass, sizeof(pwd->pass));
- }
-}
-
-/*******************************************************************
-reads or writes a SAMR_ENC_PASSWD structure.
-********************************************************************/
-
-bool samr_io_enc_passwd(const char *desc, SAMR_ENC_PASSWD * pwd,
- prs_struct *ps, int depth)
-{
- if (pwd == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_enc_passwd");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr", ps, depth, &pwd->ptr))
- return False;
-
- if (pwd->ptr != 0) {
- if(!prs_uint8s(False, "pwd", ps, depth, pwd->pass, sizeof(pwd->pass)))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_ENC_HASH structure.
-********************************************************************/
-
-void init_enc_hash(SAMR_ENC_HASH * hsh, const uchar hash[16])
-{
- ZERO_STRUCTP(hsh);
-
- if (hash == NULL) {
- hsh->ptr = 0;
- } else {
- hsh->ptr = 1;
- memcpy(hsh->hash, hash, sizeof(hsh->hash));
- }
-}
-
-/*******************************************************************
-reads or writes a SAMR_ENC_HASH structure.
-********************************************************************/
-
-bool samr_io_enc_hash(const char *desc, SAMR_ENC_HASH * hsh,
- prs_struct *ps, int depth)
-{
- if (hsh == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_enc_hash");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr ", ps, depth, &hsh->ptr))
- return False;
- if (hsh->ptr != 0) {
- if(!prs_uint8s(False, "hash", ps, depth, hsh->hash,sizeof(hsh->hash)))
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_CHGPASSWD_USER structure.
-********************************************************************/
-
-void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u,
- const char *dest_host, const char *user_name,
- const uchar nt_newpass[516],
- const uchar nt_oldhash[16],
- const uchar lm_newpass[516],
- const uchar lm_oldhash[16])
-{
- DEBUG(5, ("init_samr_q_chgpasswd_user\n"));
-
- q_u->ptr_0 = 1;
- init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE);
- init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host);
-
- init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE);
- init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name);
-
- init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass);
- init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
-
- q_u->unknown = 0x01;
-
- init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass);
- init_enc_hash(&q_u->lm_oldhash, lm_oldhash);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_chgpasswd_user(const char *desc, SAMR_Q_CHGPASSWD_USER * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0))
- return False;
-
- if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth))
- return False;
- if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth))
- return False;
- if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth))
- return False;
-
- if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth))
- return False;
- if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth))
- return False;
-
- if(!prs_uint32("unknown", ps, depth, &q_u->unknown))
- return False;
-
- if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth))
- return False;
- if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_CHGPASSWD_USER structure.
-********************************************************************/
-
-void init_samr_r_chgpasswd_user(SAMR_R_CHGPASSWD_USER * r_u, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_chgpasswd_user\n"));
-
- r_u->status = status;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_chgpasswd_user(const char *desc, SAMR_R_CHGPASSWD_USER * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_Q_CHGPASSWD3 structure.
-********************************************************************/
-
-void init_samr_q_chgpasswd_user3(SAMR_Q_CHGPASSWD_USER3 * q_u,
- const char *dest_host, const char *user_name,
- const uchar nt_newpass[516],
- const uchar nt_oldhash[16],
- const uchar lm_newpass[516],
- const uchar lm_oldhash[16])
-{
- DEBUG(5, ("init_samr_q_chgpasswd_user3\n"));
-
- q_u->ptr_0 = 1;
- init_unistr2(&q_u->uni_dest_host, dest_host, UNI_FLAGS_NONE);
- init_uni_hdr(&q_u->hdr_dest_host, &q_u->uni_dest_host);
-
- init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE);
- init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name);
-
- init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass);
- init_enc_hash(&q_u->nt_oldhash, nt_oldhash);
-
- q_u->lm_change = 0x01;
-
- init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass);
- init_enc_hash(&q_u->lm_oldhash, lm_oldhash);
-
- init_enc_passwd(&q_u->password3, NULL);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_chgpasswd_user3(const char *desc, SAMR_Q_CHGPASSWD_USER3 * q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_chgpasswd_user3");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_0", ps, depth, &q_u->ptr_0))
- return False;
-
- if(!smb_io_unihdr("", &q_u->hdr_dest_host, ps, depth))
- return False;
- if(!smb_io_unistr2("", &q_u->uni_dest_host, q_u->hdr_dest_host.buffer, ps, depth))
- return False;
-
- if(!prs_align(ps))
- return False;
- if(!smb_io_unihdr("", &q_u->hdr_user_name, ps, depth))
- return False;
- if(!smb_io_unistr2("", &q_u->uni_user_name, q_u->hdr_user_name.buffer,ps, depth))
- return False;
-
- if(!samr_io_enc_passwd("nt_newpass", &q_u->nt_newpass, ps, depth))
- return False;
- if(!samr_io_enc_hash("nt_oldhash", &q_u->nt_oldhash, ps, depth))
- return False;
-
- if(!prs_uint32("lm_change", ps, depth, &q_u->lm_change))
- return False;
-
- if(!samr_io_enc_passwd("lm_newpass", &q_u->lm_newpass, ps, depth))
- return False;
- if(!samr_io_enc_hash("lm_oldhash", &q_u->lm_oldhash, ps, depth))
- return False;
-
- if(!samr_io_enc_passwd("password3", &q_u->password3, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_CHGPASSWD_USER3 structure.
-********************************************************************/
-
-void init_samr_r_chgpasswd_user3(SAMR_R_CHGPASSWD_USER3 *r_u, NTSTATUS status,
- SAMR_CHANGE_REJECT *reject, SAM_UNK_INFO_1 *info)
-{
- DEBUG(5, ("init_samr_r_chgpasswd_user3\n"));
-
- r_u->status = status;
- r_u->info = 0;
- r_u->ptr_info = 0;
- r_u->reject = 0;
- r_u->ptr_reject = 0;
-
- if (info) {
- r_u->info = info;
- r_u->ptr_info = 1;
- }
- if (reject && (reject->reject_reason != Undefined)) {
- r_u->reject = reject;
- r_u->ptr_reject = 1;
- }
-}
-
-/*******************************************************************
- Reads or writes an SAMR_CHANGE_REJECT structure.
-********************************************************************/
-
-bool samr_io_change_reject(const char *desc, SAMR_CHANGE_REJECT *reject, prs_struct *ps, int depth)
-{
- if (reject == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_change_reject");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(UNMARSHALLING(ps))
- ZERO_STRUCTP(reject);
-
- if (!prs_uint32("reject_reason", ps, depth, &reject->reject_reason))
- return False;
-
- if (!prs_uint32("unknown1", ps, depth, &reject->unknown1))
- return False;
-
- if (!prs_uint32("unknown2", ps, depth, &reject->unknown2))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_chgpasswd_user3");
- depth++;
-
- if (!prs_align(ps))
- return False;
-
- if (!prs_uint32("ptr_info", ps, depth, &r_u->ptr_info))
- return False;
-
- /* special case: Windows 2000 can return stub data here saying
- NT_STATUS_NOT_SUPPORTED */
-
- if ( NT_STATUS_EQUAL( NT_STATUS_NOT_SUPPORTED, NT_STATUS(r_u->ptr_info)) ) {
- r_u->status = NT_STATUS_NOT_SUPPORTED;
- return True;
- }
-
- if (r_u->ptr_info && r_u->info != NULL) {
- /* SAM_UNK_INFO_1 */
- if (!sam_io_unk_info1("info", r_u->info, ps, depth))
- return False;
- }
-
- if (!prs_uint32("ptr_reject", ps, depth, &r_u->ptr_reject))
- return False;
-
- if (r_u->ptr_reject && r_u->reject != NULL) {
- /* SAMR_CHANGE_REJECT */
- if (!samr_io_change_reject("reject", r_u->reject, ps, depth))
- return False;
- }
-
- if (!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_query_domain_info2(SAMR_Q_QUERY_DOMAIN_INFO2 *q_u,
- POLICY_HND *domain_pol, uint16 switch_value)
-{
- DEBUG(5, ("init_samr_q_query_domain_info2\n"));
-
- q_u->domain_pol = *domain_pol;
- q_u->switch_value = switch_value;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_query_domain_info2(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO2 *q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_query_domain_info2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
- return False;
-
- if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_DOMAIN_INFO structure.
-********************************************************************/
-
-void init_samr_r_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2 * r_u,
- uint16 switch_value, SAM_UNK_CTR * ctr,
- NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_query_domain_info2\n"));
-
- r_u->ptr_0 = 0;
- r_u->switch_value = 0;
- r_u->status = status; /* return status */
-
- if (NT_STATUS_IS_OK(status)) {
- r_u->switch_value = switch_value;
- r_u->ptr_0 = 1;
- r_u->ctr = ctr;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INFO2 * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_query_domain_info2");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0))
- return False;
-
- if (r_u->ptr_0 != 0 && r_u->ctr != NULL) {
- if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value))
- return False;
- if(!prs_align(ps))
- return False;
-
- switch (r_u->switch_value) {
- case 0x0d:
- if(!sam_io_unk_info13("unk_inf13", &r_u->ctr->info.inf13, ps, depth))
- return False;
- break;
- case 0x0c:
- if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth))
- return False;
- break;
- case 0x09:
- if(!sam_io_unk_info9("unk_inf9",&r_u->ctr->info.inf9, ps,depth))
- return False;
- break;
- case 0x08:
- if(!sam_io_unk_info8("unk_inf8",&r_u->ctr->info.inf8, ps,depth))
- return False;
- break;
- case 0x07:
- if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth))
- return False;
- break;
- case 0x06:
- if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth))
- return False;
- break;
- case 0x05:
- if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth))
- return False;
- break;
- case 0x04:
- if(!sam_io_unk_info4("unk_inf4",&r_u->ctr->info.inf4, ps,depth))
- return False;
- break;
- case 0x03:
- if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth))
- return False;
- break;
- case 0x02:
- if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth))
- return False;
- break;
- case 0x01:
- if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth))
- return False;
- break;
- default:
- DEBUG(0, ("samr_io_r_query_domain_info2: unknown switch level 0x%x\n",
- r_u->switch_value));
- r_u->status = NT_STATUS_INVALID_INFO_CLASS;
- return False;
- }
- }
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO *q_u,
- POLICY_HND *domain_pol, uint16 switch_value, SAM_UNK_CTR *ctr)
-{
- DEBUG(5, ("init_samr_q_set_domain_info\n"));
-
- q_u->domain_pol = *domain_pol;
- q_u->switch_value0 = switch_value;
-
- q_u->switch_value = switch_value;
- q_u->ctr = ctr;
-
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_q_set_domain_info(const char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u,
- prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_q_set_domain_info");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth))
- return False;
-
- if(!prs_uint16("switch_value0", ps, depth, &q_u->switch_value0))
- return False;
-
- if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if (UNMARSHALLING(ps)) {
- if ((q_u->ctr = PRS_ALLOC_MEM(ps, SAM_UNK_CTR, 1)) == NULL)
- return False;
- }
-
- switch (q_u->switch_value) {
-
- case 0x0c:
- if(!sam_io_unk_info12("unk_inf12", &q_u->ctr->info.inf12, ps, depth))
- return False;
- break;
- case 0x07:
- if(!sam_io_unk_info7("unk_inf7",&q_u->ctr->info.inf7, ps,depth))
- return False;
- break;
- case 0x06:
- if(!sam_io_unk_info6("unk_inf6",&q_u->ctr->info.inf6, ps,depth))
- return False;
- break;
- case 0x05:
- if(!sam_io_unk_info5("unk_inf5",&q_u->ctr->info.inf5, ps,depth))
- return False;
- break;
- case 0x03:
- if(!sam_io_unk_info3("unk_inf3",&q_u->ctr->info.inf3, ps,depth))
- return False;
- break;
- case 0x02:
- if(!sam_io_unk_info2("unk_inf2",&q_u->ctr->info.inf2, ps,depth))
- return False;
- break;
- case 0x01:
- if(!sam_io_unk_info1("unk_inf1",&q_u->ctr->info.inf1, ps,depth))
- return False;
- break;
- default:
- DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n",
- q_u->switch_value));
- return False;
- }
-
- return True;
-}
-
-/*******************************************************************
-inits a SAMR_R_QUERY_DOMAIN_INFO structure.
-********************************************************************/
-
-void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO * r_u, NTSTATUS status)
-{
- DEBUG(5, ("init_samr_r_set_domain_info\n"));
-
- r_u->status = status; /* return status */
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-bool samr_io_r_set_domain_info(const char *desc, SAMR_R_SET_DOMAIN_INFO * r_u,
- prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "samr_io_r_samr_unknown_2e");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("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..62c1e21927 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)
@@ -899,195 +589,3 @@ bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVIC
return True;
}
-
-/*******************************************************************
-********************************************************************/
-
-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)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_query_service_sec");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("handle", &q_u->handle, ps, depth))
- return False;
- if(!prs_uint32("security_flags", ps, depth, &q_u->security_flags))
- return False;
- if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
- return False;
-
- return True;
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_query_service_sec(const char *desc, SVCCTL_R_QUERY_SERVICE_SEC *r_u, prs_struct *ps, int depth)
-{
- if ( !r_u )
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_query_service_sec");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if (!prs_rpcbuffer("buffer", ps, depth, &r_u->buffer))
- return False;
-
- if(!prs_uint32("needed", ps, depth, &r_u->needed))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_q_set_service_sec(const char *desc, SVCCTL_Q_SET_SERVICE_SEC *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_set_service_sec");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("handle", &q_u->handle, ps, depth))
- return False;
- if(!prs_uint32("security_flags", ps, depth, &q_u->security_flags))
- return False;
-
- if (!prs_rpcbuffer("buffer", ps, depth, &q_u->buffer))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
- return False;
-
- return True;
-
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_set_service_sec(const char *desc, SVCCTL_R_SET_SERVICE_SEC *r_u, prs_struct *ps, int depth)
-{
- if ( !r_u )
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_set_service_sec");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-
-
-